ngin 多域名配置
user root; worker_processes 1; events { worker_connections 65535; } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main; sendfile on; keepalive_timeout 65 65; server { listen 80;
#第一个域名 server_name www.magege.com; location / { root /usr/share/nginx/html; index index.html; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } server { listen 80;
#第二个域名 server_name app.magege.com; location / { root /usr/share/nginx/app; index index.html; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } server { listen 443 ssl http2 default_server; listen [::]:443 ssl http2 default_server; server_name 49.232.195.203; root /usr/share/nginx/html; ssl_certificate /home/certs/www.magedu.net.crt; ssl_certificate_key /home/certs/www.magedu.net.key; ssl_session_cache shared:SSL:20m; ssl_session_timeout 10m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers off; include /etc/nginx/default.d/*.conf; location / { index index.html index.php index.htm; } location ~ \.php$ { root /home/opt/nginx/html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } error_page 404 /404.html; location = /404.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } }