Answer the question
In order to leave comments, you need to log in
How to attach a domain to a website that is running on a different port?
There is a server on Linux Ubunu
The server has nginx installed
There is a domain mysite.com the
domain is attached to the server
The site is written in Vue JS and works on port 3000 :3000 ?
The website is not displayed at the moment
If I go to the server address, then the standard nginx template appears
The nginx config file for my site:
server {
listen 80;
server_name mysite.com www.mysite.com;
root /home/kentforth/webapps/mysite/dist;
index index.html index.htm;
location / {
root /home/kentforth/webapps/mysite/dist;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://123.534.65.77:3000;
try_files $uri $uri/ /index.html;
}
error_log /var/log/nginx/vue-app-error.log;
access_log /var/log/nginx/vue-app-access.log;
}
Answer the question
In order to leave comments, you need to log in
Why do you have both root
, proxy_pass
and in your location try_files
? Decide what you want - if you only proxy in Vue, then the second option does it.
This is a simple configuration, but a working one. Without IP address forwarding and WebSocket redirection
server {
listen 80 default_server;
server_name mysite.com;
add_header Strict-Transport-Security 'max-age=31536000' always;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
location / {
proxy_pass http://123.534.65.77:3000;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question