Created
July 17, 2020 12:08
-
-
Save saurshaz/ca097dd5d94f46c5530360b21f280dc4 to your computer and use it in GitHub Desktop.
nginx config for vhost setup to proxy for an app running at 3000
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fastcgi_cache_path /var/cache/nginx/welcome.com_fastcgi levels=1:2 keys_zone=welcome.com_fastcgi:5m max_size=67108864; | |
server { | |
listen XXX.XX.XX.XX:80; | |
server_name example.com; | |
server_name www.example.com; | |
server_name ipv4.example.com; | |
error_page 400 "/error_docs/bad_request.html"; | |
error_page 401 "/error_docs/unauthorized.html"; | |
error_page 403 "/error_docs/forbidden.html"; | |
error_page 404 "/error_docs/not_found.html"; | |
error_page 500 "/error_docs/internal_server_error.html"; | |
error_page 405 "/error_docs/method_not_allowed.html"; | |
error_page 406 "/error_docs/not_acceptable.html"; | |
error_page 407 "/error_docs/proxy_authentication_required.html"; | |
error_page 412 "/error_docs/precondition_failed.html"; | |
error_page 414 "/error_docs/request_uri_too_long.html"; | |
error_page 415 "/error_docs/unsupported_media_type.html"; | |
error_page 501 "/error_docs/not_implemented.html"; | |
error_page 502 "/error_docs/bad_gateway.html"; | |
error_page 503 "/error_docs/maintenance.html"; | |
location ^~ /error_docs { | |
root "/var/www/vhosts/example.com"; | |
} | |
client_max_body_size 128m; | |
access_log "/var/www/vhosts/system/example.com/logs/proxy_access_log"; | |
error_log "/var/www/vhosts/system/example.com/logs/proxy_error_log"; | |
add_header X-Cache-Status $upstream_cache_status; | |
set $no_cache ""; | |
set $cache_cookie $http_cookie; | |
if ($cache_cookie !~ "^\s*$") { | |
set $no_cache 1; | |
} | |
location ~ /\.ht { | |
deny all; | |
} | |
location @fallback { | |
return 404; | |
} | |
location / { | |
proxy_pass http://127.0.0.1:3000; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Accel-Internal /internal-nginx-static-location; | |
access_log off; | |
} | |
add_header X-Powered-By PleskLin; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment