Skip to content

Instantly share code, notes, and snippets.

@meumairakram
Created December 10, 2021 13:09
Show Gist options
  • Save meumairakram/9348f9d6ffc88898e20467801c37a33e to your computer and use it in GitHub Desktop.
Save meumairakram/9348f9d6ffc88898e20467801c37a33e to your computer and use it in GitHub Desktop.
Install pm2 on server
Start process on Pm2 on a PORT of your choice . Can be 3000 OR 30001 or any other port except 80 and 443
Goto /etc/nginx/sites-available
Edit default file, or copy it to a new file with Server name
add This in the server Block for Nginx
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
location / {
proxy_pass http://127.0.0.1:3000;
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header Host $http_host;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "upgrade";
}
# pass PHP scripts to FastCGI server
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
# fastcgi_pass unix:/run/php/php7.3-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment