Answer the question
In order to leave comments, you need to log in
How to fit 2 sites on one IP?
There are VPS. It costs Nginx and spins 2 nodejs applications. One listens on port 8080, the second on port 3000. And 2 configs for Nginx that connect to the main file.
First (website is up):
server {
listen 80;
server_name domen.ru www.domen.ru;
proxy_set_header Host domen.ru;
location / {
rewrite ^(.*)$ https://domen.ru$1 permanent;
}
return 301 https://domen.ru$request_uri;
}
server {
listen 443 ssl http2;
server_name domen.ru www.domen.ru;
# и дальше настройки SSL и т. п.
# все работает
.........
}
server {
listen 80;
server_name domen2.ru www.domen2.ru;
access_log /home/vpsuser/projects/log/domen2.ru/access.log combined;
error_log /home/vpsuser/projects/log/domen2.ru/error.log warn;
location / {
proxy_pass http://localhost:3000;
}
}
Answer the question
In order to leave comments, you need to log in
Who did you write the documentation for?
nginx.org/ru/docs/http/configuring_https_servers.html
You may have deleted the default nginx config.
Do something like this very first in sites-available.
server {
listen 80;
server_name _;
location / {
return 204;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question