centos lamp虚拟主机配置

2018-10-23  本文已影响0人  奋斗live

可以通过修改/etc/httpd/conf/http.conf 的documentRoot来修改目录位置,如下

image.png

根据域名配置虚拟主机,

 <VirtualHost *:80>  
    #绑定的主域  
    ServerName app.ff.com

    #绑定的子域名  
    ServerAlias app.ff.com 

    #网站主目录  
    DocumentRoot /www/app.ff.com  

    #日志路径配置(如果没有,请记得创建)  
    #ErrorLog /var/www/html/web_log/error_shulv.com.log  
    #CustomLog /var/www/html/web_log/custom_shulv.com.log common  

    #ServerSignature Off  
    </VirtualHost>  
    #网站的配置  
    <Directory "/www/app.ff.com">  
        Options FollowSymLinks  
        AllowOverride All  
        Require all granted  
    </Directory>
    
    <VirtualHost *:80>  
    #绑定的主域  
    ServerName web.fgf.com  

    #绑定的子域名  
    ServerAlias web.fgf.com  

    #网站主目录  
    DocumentRoot /www/web.fgf.com/  

    #日志路径配置(如果没有,请记得创建)  
    #ErrorLog /var/www/html/web_log/error_shulv.com.log  
    #CustomLog /var/www/html/web_log/custom_shulv.com.log common  

    #ServerSignature Off  
    </VirtualHost>  
    #网站的配置  
    <Directory "/www/web.fgf.com/">  
        Options FollowSymLinks  
        AllowOverride All  
        Require all granted  
    </Directory>

最后重启 service httpd restart

注意,可能以上还是不成功,访问域名会访问到对应的欢迎页面

需要执行以下命令

setenforce 0

或者用下面的进行永久关闭

/etc/selinux/config

如下,改成disabled
SELINUX=disabled

重启电脑

上一篇 下一篇

猜你喜欢

热点阅读