nginx 配置
1 user nginx; 2 worker_processes auto; 3 error_log /var/log/nginx/error.log; 4 pid /run/nginx.pid; 5 6 events { 7 worker_connections 1024; 8 } 9 10 http { 11 log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 12 '$status $body_bytes_sent "$http_referer" ' 13 '"$http_user_agent" "$http_x_forwarded_for"'; 14 15 access_log /var/log/nginx/access.log main; 16 17 sendfile on; 18 tcp_nopush on; 19 tcp_nodelay on; 20 keepalive_timeout 65; 21 types_hash_max_size 2048; 22 23 include /etc/nginx/mime.types; 24 default_type application/octet-stream; 25 26 # Load modular configuration files from the /etc/nginx/conf.d directory. 27 # See http://nginx.org/en/docs/ngx_core_module.html#include 28 # for more information. 29 include /etc/nginx/conf.d/*.conf; 30 31 server { 32 listen 80 default_server; 33 listen [::]:80 default_server; 34 server_name _; 35 root /usr/share/nginx/html; 36 37 # Load configuration files for the default server block. 38 include /etc/nginx/default.d/*.conf; 39 40 location / { 41 } 42 43 error_page 404 /404.html; 44 location = /40x.html { 45 } 46 47 error_page 500 502 503 504 /50x.html; 48 location = /50x.html { 49 } 50 } 51 52 53 server { 54 listen 80 ; 55 #listen [::]:80 default_server; 56 server_name www.yygui.cn yygui.cn; 57 root /web; 58 59 # Load configuration files for the default server block. 60 include /etc/nginx/default.d/*.conf; 61 62 location ~ .php$ { 63 proxy_set_header Host $http_host; 64 proxy_set_header X-Real-IP $remote_addr; 65 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 66 67 proxy_pass http://127.0.0.1:8080; 68 } 69 70 location / { 71 } 72 73 error_page 404 /404.html; 74 location = /40x.html { 75 } 76 77 error_page 500 502 503 504 /50x.html; 78 location = /50x.html { 79 } 80 } 81 }
http 配置
1 ServerRoot "/etc/httpd" 2 3 Listen 8080 4 5 Include conf.modules.d/*.conf 6 7 User apache 8 Group apache 9 10 11 ServerAdmin root@localhost 12 13 14 <Directory /> 15 AllowOverride none 16 Require all denied 17 </Directory> 18 19 20 DocumentRoot "/var/www/html" 21 22 <Directory "/var/www"> 23 AllowOverride None 24 Require all granted 25 </Directory> 26 27 <Directory "/var/www/html"> 28 Options Indexes FollowSymLinks 29 30 AllowOverride None 31 32 Require all granted 33 </Directory> 34 35 <IfModule dir_module> 36 DirectoryIndex index.html 37 </IfModule> 38 39 <Files ".ht*"> 40 Require all denied 41 </Files> 42 43 ErrorLog "logs/error_log" 44 45 LogLevel warn 46 47 <IfModule log_config_module> 48 LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined 49 LogFormat "%h %l %u %t "%r" %>s %b" common 50 51 <IfModule logio_module> 52 LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i" %I %O" combinedio 53 </IfModule> 54 55 56 CustomLog "logs/access_log" combined 57 </IfModule> 58 59 <IfModule alias_module> 60 61 62 ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" 63 64 </IfModule> 65 66 <Directory "/var/www/cgi-bin"> 67 AllowOverride None 68 Options None 69 Require all granted 70 </Directory> 71 72 <IfModule mime_module> 73 TypesConfig /etc/mime.types 74 75 AddType application/x-compress .Z 76 AddType application/x-gzip .gz .tgz 77 AddType application/x-httpd-php .php 78 79 80 AddType text/html .shtml 81 AddOutputFilter INCLUDES .shtml 82 </IfModule> 83 84 AddDefaultCharset UTF-8 85 86 <IfModule mime_magic_module> 87 MIMEMagicFile conf/magic 88 </IfModule> 89 90 91 <VirtualHost *:8080> 92 DocumentRoot "/web" 93 ServerName www.yygui.cn 94 ServerAlias yygui.cn 95 ErrorLog "/home/wwwlogs/www.a.com-error_log" 96 CustomLog "/home/wwwlogs/www.a.com-access_log" combined 97 <Directory "/web"> 98 Options Indexes FollowSymLinks Includes ExecCGI 99 AllowOverride All 100 Require all granted 101 DirectoryIndex index.html index.php 102 </Directory> 103 </VirtualHost> 104 105 106 EnableSendfile on 107 108 IncludeOptional conf.d/*.conf