1. nginx 配置小程序和后台 提示:域名和服务器绑定
1 user nginx; 2 worker_processes auto; 3 error_log /var/log/nginx/error.log; 4 pid /run/nginx.pid; 5 6 include /usr/share/nginx/modules/*.conf; 7 8 events { 9 worker_connections 1024; 10 } 11 12 http { 13 log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 14 '$status $body_bytes_sent "$http_referer" ' 15 '"$http_user_agent" "$http_x_forwarded_for"'; 16 17 access_log /var/log/nginx/access.log main; 18 19 sendfile on; 20 tcp_nopush on; 21 tcp_nodelay on; 22 keepalive_timeout 65; 23 types_hash_max_size 2048; 24 25 include /etc/nginx/mime.types; 26 default_type application/octet-stream; 27 28 include /etc/nginx/conf.d/*.conf; 29 30 31 server { 32 listen 80 default_server; 33 listen [::]:80 default_server; 34 server_name signup.shengweiholdings.com; 35 rewrite ^(.*)$ https://${server_name}$1 permanent; 36 } 37 38 39 server { 40 listen 443 ssl http2 default_server; 41 listen [::]:443 ssl http2 default_server; 42 server_name signup.shengweiholdings.com; 43 44 ssl_certificate "/etc/pki/nginx/server.pem"; 45 ssl_certificate_key "/etc/pki/nginx/server.key"; 46 ssl_session_cache shared:SSL:1m; 47 ssl_session_timeout 10m; 48 ssl_ciphers HIGH:!aNULL:!MD5; 49 ssl_prefer_server_ciphers on; 50 51 location / { 52 proxy_pass http://47.107.253.138:8081/; 53 } 54 55 location /school { 56 proxy_pass http://47.107.253.138:8082/; 57 } 58 59 location ~ .*\.(gif|jpg|pdf|jpeg|png)$ { 60 root /shengweisignup/upload/; 61 client_max_body_size 10M; 62 client_body_buffer_size 1280k; 63 } 64 } 65 }nginx配置