centos7上apache_httpd2.4配置

一定查看日志,根据日志来排除问题 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/

静态页面


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

反向代理

 
         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

 
         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



        ServerName image.abc.com
        DocumentRoot /alidata/imageserver/decoration
        
            Options Indexes FollowSymlinks
            AllowOverride All
            Require all granted
        
        ErrorLog "/etc/httpd/logs/image_error_log"
        CustomLog "/etc/httpd/logs/image_log" common

你可能感兴趣的:(centos7上apache_httpd2.4配置)