Answer the question
In order to leave comments, you need to log in
How to generate nginx config?
4 hours went by as I try to write the nginx config correctly. Help me, please, otherwise I'll go crazy ...
server {
listen 80;
server_name domain.ru;
return 301 https://$host$request_uri;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
allow all;
auth_basic off;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
}
server {
listen 8002 default_server;
ssl on;
ssl_certificate /etc/letsencrypt/live/domain.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.ru/privkey.pem;
server_name _;
location / {
proxy_pass http://127.0.0.1:8001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
}
}
server {
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name domain.ru;
satisfy all;
auth_basic "Please Log-In";
auth_basic_user_file /etc/nginx/.htpasswd;
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/domain.ru/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/domain.ru/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question