From 9de7b87d2b363db7f0d38006b4b58703afcede72 Mon Sep 17 00:00:00 2001 From: Tjatse Date: Fri, 13 May 2016 17:18:01 +0800 Subject: [PATCH] confs of nginx --- examples/nginx/pm.example.com.conf | 35 ++++++++++++++ examples/nginx/pm2.example.com.conf | 75 +++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 examples/nginx/pm.example.com.conf create mode 100644 examples/nginx/pm2.example.com.conf diff --git a/examples/nginx/pm.example.com.conf b/examples/nginx/pm.example.com.conf new file mode 100644 index 0000000..250d354 --- /dev/null +++ b/examples/nginx/pm.example.com.conf @@ -0,0 +1,35 @@ +map $http_upgrade $connection_upgrade { + default upgrade; + '' close; +} + +upstream pm2-gui { + server 127.0.0.1:8088; +} + +server { + listen 80; + server_name pm2-gui.dev; + + #useless but can not get rid of. + root /path/to/pm2-gui/web/public; + + try_files $uri/index.html $uri.html $uri @app; + + # paths + location @app { + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + proxy_redirect off; + + proxy_pass http://pm2-gui; + } + + # socket.io + location /socket.io { + proxy_pass http://pm2-gui; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + } +} \ No newline at end of file diff --git a/examples/nginx/pm2.example.com.conf b/examples/nginx/pm2.example.com.conf new file mode 100644 index 0000000..0e8641b --- /dev/null +++ b/examples/nginx/pm2.example.com.conf @@ -0,0 +1,75 @@ +# +# The default server +# +server { + listen 80; + server_name pm2.example.com; + + charset utf-8; + + location / { + root /var/www/node-sites; + proxy_redirect off ; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header REMOTE-HOST $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + client_max_body_size 50m; + client_body_buffer_size 256k; + proxy_connect_timeout 30; + proxy_send_timeout 30; + proxy_read_timeout 60; + proxy_buffer_size 256k; + proxy_buffers 4 256k; + proxy_busy_buffers_size 256k; + proxy_temp_file_write_size 256k; + proxy_next_upstream error timeout invalid_header http_500 http_503 http_404; + proxy_max_temp_file_size 128m; + proxy_pass http://127.0.0.1:8088; + } + location /socket.io/ { + proxy_pass http://127.0.0.1:8088; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_http_version 1.1; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $host; + } + + + error_page 404 /404.html; + location = /404.html { + root /usr/share/nginx/html; + } + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + + # proxy the PHP scripts to Apache listening on 127.0.0.1:80 + # + #location ~ \.php$ { + # proxy_pass http://127.0.0.1; + #} + + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 + # + #location ~ \.php$ { + # root html; + # fastcgi_pass 127.0.0.1:9000; + # fastcgi_index index.php; + # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; + # include fastcgi_params; + #} + + # deny access to .htaccess files, if Apache's document root + # concurs with nginx's one + # + #location ~ /\.ht { + # deny all; + #} +} +