Apache配置文件:httpd.conf文件
# 指定Apache的安装路径,此选项参数值在安装Apache时系统会自动把Apache的路径写入。 ServerRoot "/www/server/apache"
# Listen主要侦听web服务端口状态,默认为:80,即侦听所有的地址的80端口,注意这里也可以写成IP地址的侦听形式,不写即默认的地址:0.0.0.0 Listen 106.15.88.162:80 Listen 80
# 指定Apache运行用户配置 User www Group www
# 指定Apache服务管理员通知邮箱地址,选择默认值即可,如果有真实的邮箱地址也可以设置此值 ServerAdmin you@example.com
# 指定Apache默认的服务器名以及端口,默认参数值设置为:ServerName localhost:80即可 ServerName 0.0.0.0:80
# 设置Apache的日志级别,访问日志路径,错误日志路径。 # 参考:https://blog.51cto.com/longlei/2095594与https://blog.csdn.net/u013699800/article/details/37593491 LogLevel warn ErrorLog "/www/wwwlogs/error_log" <IfModule log_config_module> LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined LogFormat "%h %l %u %t "%r" %>s %b" common <IfModule logio_module> LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i" %I %O" combinedio </IfModule> CustomLog "/www/wwwlogs/access_log" common # 普通文件记录,common格式就是标准格式。 CustomLog "/www/wwwlogs/access_log" combined # 复合日志记录 </IfModule>
Apache配置文件:httpd-ssl.conf文件(配置ssl)
<VirtualHost *:443> ServerAdmin webmasterexample.com DocumentRoot "/www/wwwroot/liudong.top/" ServerName SSL.liudong.top ServerAlias liudong.top errorDocument 404 /404.html ErrorLog "/www/wwwlogs/liudong.top-error_log" CustomLog "/www/wwwlogs/liudong.top-access_log" combined #SSL SSLEngine On SSLCertificateFile /etc/letsencrypt/live/liudong.top/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/liudong.top/privkey.pem SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH SSLProtocol All -SSLv2 -SSLv3 SSLHonorCipherOrder On </VirtualHost>
https://www.cnblogs.com/liaokong/p/9158962.html
重定向问题
#301-START #方法1 <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} ^adspush.com [NC] RewriteRule ^(.*) http://www1.adspush.com$1 [L,R=301] </IfModule> <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} ^www.adspush.com [NC] RewriteRule ^(.*) http://www1.adspush.com$1 [L,R=301] </IfModule> #方法2:其中www1.adspush.com为最终希望出现的域名。其中OR的含义为"或",可以通过OR继续添加更多的域名。 <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^adspush.com [NC] RewriteCond %{HTTP_HOST} ^www.adspush.com [NC,OR] RewriteRule ^(.*)$ http://www1.adspush.com/$1 [L,R=301] </IfModule> #301-END