Answer the question
In order to leave comments, you need to log in
How to deploy ExpressJS on nginx server?
Good day to all! There is an application site on expressjs. The task is to deploy it on the nginx server, there is a subdomain, and a white ip. Please share your experience or links. Thanks in advance!
Answer the question
In order to leave comments, you need to log in
Login via SSH
Install GIT
Change the nginx config
Clone the turnip
Do npm install
Do npm start
An example of my config:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 1024;
multi_accept on;
}
http {
sendfile on;
access_log /root/projects/logs/domen.ru/access.log;
error_log /root/projects/logs/domen.ru/error.log crit;
gzip on;
gzip_disable "msie6";
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
server {
listen 80;
server_name domen.ru www.domen.ru;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name domen.ru www.domen.ru;
keepalive_timeout 60;
keepalive_requests 50;
ssl_certificate /root/domen.ru.ssl/domen.ru.crt;
ssl_certificate_key /root/domen.ru.ssl/domen.ru.key;
ssl_session_cache shared:SSL:30m;
ssl_session_timeout 1h;
ssl_stapling on;
resolver 8.8.8.8;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 SSLv2 SSLv3;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA !RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS";
ssl_dhparam /root/domen.ru.ssl/domen.ru.dh4096.pem;
add_header Strict-Transport-Security 'max-age=604800';
location / {
proxy_pass http://localhost:8080;
#proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
client_max_body_size 10m;
client_body_buffer_size 256k;
proxy_connect_timeout 120;
proxy_send_timeout 120;
proxy_read_timeout 120;
proxy_buffer_size 128k;
proxy_buffers 32 128k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question