【nginx.conf】
user www www; worker_processes 4; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; worker_rlimit_nofile 51200; events { use epoll; worker_connections 51200; } 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"‘ ‘$connection $upstream_addr ‘ ‘upstream_response_time $upstream_response_time request_time $request_time ‘; #access_log logs/access.log main; sendfile on; tcp_nopush on; server_tokens off; keepalive_timeout 180; tcp_nodelay on; gzip on; gzip_comp_level 5; gzip_min_length 1k; gzip_buffers 8 256k; gzip_http_version 1.0; gzip_types text/plain application/x-javascript text/css application/xml; gzip_vary on; postpone_output 1460; client_header_buffer_size 512k; server { listen 80; server_name localhost; root /var/www/html/test/; #access_log /usr/local/nginx/logs/default.access.log main; location / { index index.html index.htm index.php; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ \.php$ { fastcgi_index index.php; include fastcgi_params; fastcgi_connect_timeout 120; fastcgi_send_timeout 180; fastcgi_read_timeout 180; fastcgi_buffer_size 1024k; fastcgi_buffers 32 1024k; } location ~ .*\.(css|js|swf|jpg|gif|png|jpep|jpg|mp3|xx|xmlbak|xml)$ { expires 15d; } location ~ .*\.(js|css)?$ { expires 1d; } } include vhost/*.conf; }
___________________________________________________________________________________________________________________________________________________
w.xxxxxx.com.conf
server { listen 443; server_name w.xxxxxx.com; ssl on; #charset utf-8; index index.html index.htm index.php; root /var/www/html/w; ssl_certificate /usr/local/openresty/cert/214.pem; ssl_certificate_key /usr/local/openresty/cert/214.key; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; #location / { # if (!-e $request_filename) { # rewrite ^/(.*)$ /index.php?$1 last; # } #} location /api/ { root html; index index.html index.htm; proxy_pass https://api.xxxxxx.com/; } access_log /home/www/log/nginx/w.xxxxxx.com.log main; error_log /home/www/log/nginx/w.xxxxxx.com.nginx_error.log; location /callback/ { ##rewrite ^/callback/(.*) /$1 break; ##proxy_redirect off; proxy_pass http://api.xxxxxx.com; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Authorization $http_authorization; } location /mapi { ##rewrite ^/callback/(.*) /$1 break; ##proxy_redirect off; proxy_pass http://api.xxxxxx.com; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Authorization $http_authorization; } location ~ \.php$ { fastcgi_index index.php; include fastcgi_params; } location = /favicon.ico { log_not_found off; access_log off; } }