美文网首页
centos7上apache_httpd2.4配置

centos7上apache_httpd2.4配置

作者: DuskFlowers | 来源:发表于2018-06-14 23:02 被阅读0次

一定查看日志,根据日志来排除问题 website-error.log

  1. httpd.conf 注释放开
    ServerName localhost:80

  2. 防火墙
    a.查看已开放的端口(默认不开放任何端口)
    firewall-cmd --list-ports
    b.开启80端口
    firewall-cmd --zone=public --add-port=80/tcp --permanent

  3. 静态文件加权限
    chmod +755 *

  4. 环境变更至指定环境
    chcon -R -t httpd_sys_content_t /cqdata/website/

静态页面

<VirtualHost *:80>
 ServerName localhost
 DocumentRoot "/cqdata/website"
 DirectoryIndex index.html
 <Directory "/cqdata/website">
         Options -Indexes +FollowSymlinks
         AllowOverride All
         Require all granted
 </Directory>
 ErrorLog "/var/log/httpd/website-error.log"
 CustomLog "/var/log/httpd/website.log" common
</VirtualHost>

反向代理

<VirtualHost *:80> 
         ServerName www.abc.com 
         ProxyPass / http://127.0.0.1:8080/
         ProxyPassReverse / http://127.0.0.1:8080/
         ErrorLog "/etc/httpd/logs/error_log"
    CustomLog "/etc/httpd/logs/access_log" common
</VirtualHost>
<VirtualHost *:80> 
         ServerName abc.com 
         ProxyPass / http://127.0.0.1:8080/
         ProxyPassReverse / http://127.0.0.1:8080/
         ErrorLog "/etc/httpd/logs/error_log"
    CustomLog "/etc/httpd/logs/access_log" common
</VirtualHost>

<virtualHost *:80>
        ServerName image.abc.com
        DocumentRoot /alidata/imageserver/decoration
        <Directory "/alidata/imageserver/decoration">
            Options Indexes FollowSymlinks
            AllowOverride All
            Require all granted
        </Directory>
        ErrorLog "/etc/httpd/logs/image_error_log"
        CustomLog "/etc/httpd/logs/image_log" common
</VirtualHost>

相关文章

网友评论

      本文标题:centos7上apache_httpd2.4配置

      本文链接:https://www.haomeiwen.com/subject/rvbueftx.html