x.conf
server { listen 80; server_name x.com www.x.com; return 301 https://www.x.com$request_uri;}
x443.conf
upstream mywebs { server 192.168.0.100:8080; server 192.168.0.101:8080; keepalive 200;}server { listen 443; server_name x.com www.x.com; error_page 404 = /404.html; ssl on; ssl_certificate /etc/nginx/tencentssl/1_www.x.com_bundle.crt; ssl_certificate_key /etc/nginx/tencentssl/2_www.x.com.key; if ($http_host !~ "^www.x.com$") { rewrite ^(.*) https://www.x.com$1 permanent; } location / { proxy_pass http://mywebs; proxy_http_version 1.1; proxy_set_header Connection ""; } location /front/ { root /www/x; }}
nginx.conf
user nginx;worker_processes 2;error_log /var/log/nginx/error.log warn;pid /var/run/nginx.pid;events { worker_connections 4096;}http { include /etc/nginx/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 /var/log/nginx/access.log main; server_tokens off; sendfile on; #tcp_nopush on; keepalive_timeout 20; gzip on; gzip_types text/plain application/xml application/json; gzip_comp_level 4; include /etc/nginx/conf.d/*.conf;}