抓log
log_format main '$remote_addr\t$remote_user\t[$time_local]\t"$request"\t$status\t$bytes_sent\t' '"$http_referer"\t"$http_user_agent"\t"$http_cookie"\t"$request_body"';
location / {
lua_need_request_body on;
#content_by_lua 'local s = ngx.var.request_body';
}
access_log /www/wwwlogs/main.log main;
server {
listen 80;
server_name localhost;
root "d:/phpstudy_pro/WWW";
location ^~ /ybinu/upload/ {
#return 405;
root D:/data/;
autoindex on;
}
location ^~ /upload/ {
root D:/data/ybinu/;
autoindex on;
}
location ^~ /ybinu {
index index.php index.html;
error_page 400 /error/400.html;
error_page 403 /error/403.html;
error_page 404 /error/404.html;
proxy_pass http://127.0.0.1:8080/ybinu;
proxy_set_header Host $http_host;
proxy_set_header X-Forward-For $remote_addr;
autoindex off;
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
ws转wss
upstream websocket {
server 119.91.250.33:8088;
}
server {
listen 443 ssl;
server_name www.javays.com;
ssl_certificate /etc/nginx/www.javays.com_bundle.crt;
ssl_certificate_key /etc/nginx/www.javays.com.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://119.91.253.38:8080;
}
location /wss {
proxy_pass http://websocket/;
proxy_read_timeout 60s;
proxy_set_header Host $host;
proxy_set_header X-Real_IP $remote_addr;
proxy_set_header X-Forwarded-for $remote_addr;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'Upgrade';
}
}