您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

CentOS apache配置虚拟服务器

2025/11/24 5:50:59发布11次查看
注意: 1、需要确定的端口是否存在: semanageport-l|grephttp,如果http_port_t后面有需要用到的端口,则需要确定该端口是否被占用:semanageport-l|grephttp81,如果被占用,则需要添加额外的端口: semanageport-a-thttp_port_t-ptcp82 ; 2、用到的端口
注意:
1、需要确定的端口是否存在:
semanage port -l | grep http,如果http_port_t 后面有需要用到的端口,则需要确定该端口是否被占用:semanage port -l | grep http 81,如果被占用,则需要添加额外的端口:semanage port -a -t http_port_t -p tcp 82;
2、用到的端口需要先在防火墙中添加,否则只能用内网访问到挂载的站点;
vim  /etc/sysconfig/iptables
在里面加入:
-a input -m state --state new -m tcp -p tcp --dport 8888 -j accept
重启防火墙服务:service iptables restart
1、基于同一个ip、多端口的虚拟主机配置:
listen 80
listen 8888
servername localhsot
namevirtualhost *:80
documentroot /var/www/example1
    servername www.example1.com
    errorlog logs/example1-error_log
    customlog logs/example1-access_log common
namevirtualhost *:8888
documentroot /var/www/example2
    servername www.example2.com
    errorlog logs/example2-error_log
    customlog logs/example2-access_log common
servername需要注册,否则无效!
3、用vim打开httpd.conf文件时,提示输入密码,如果不输入密码直接按enter也可以进入文件,但是显示的是乱码,在网上扒了很久,没有找到问题的解决方法,最后被迫把配置文件重新弄了一遍,教训:做好数据的备份!
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product