raevillena
Fanatic
Dito mag bibigay ako ng sample para mag configure sa nginx ng mga developed apps/backend/listeners nyo galing sa nodejs, uwsgi or anything similar.
Usually deployed ang mga backend apps or servers sa mga port na non standard and hindi maganda sa eyes pag ginagamit na ng user.
Usually gusto naten is padaanin sa port 80, 443 or http and https. Nasa baba yung sample ng code snippet para sa isang simple na deployment.
Assumptions:
Usually deployed ang mga backend apps or servers sa mga port na non standard and hindi maganda sa eyes pag ginagamit na ng user.
Usually gusto naten is padaanin sa port 80, 443 or http and https. Nasa baba yung sample ng code snippet para sa isang simple na deployment.
Assumptions:
- you have app running at port 8000
- it can be accessed at 127.0.0.1 internally
- you have "example.com" as you domain pointing at the server
- nasa /var/www/example.com ang mga static files mo
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name example.com;
root /var/www/example.com;
index index.html index.htm index.nginx-debian.html;
location / {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://127.0.0.1:8000;
#include /etc/nginx/uwsgi_params; #block for uwsgi standard params
#uwsgi_pass unix:///home/user/dashboard.sock;
}
location /static {
alias /home/user/static; #pwede magset ng seperate alias for a folder kung saan palaging naka tingin ang /static/ sa url
}
}