I want to run two nuxt.js domains on single droplet. I have configured everything but when I open the domain, nginx says 404 not found.
Npm run build works fine for both domains inside /var/www/domain1 and var/www/domain2 and I think issue is with the sites-available vim default configuration.
Here is my configuration:
server { listen 80; server_name domain1.com;
location / {
proxy_pass http://127.0.0.1:3333;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
} server { listen 80; server_name domain2.co.in;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
I’m running domain1 on port 3333 and domain2 on 3000 sothat port issue does not occur. Do i need to change anything in site-available file?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hey @aashaytrivedi1,
You need to create two Nginx configuration files. Basically, every domain needs to have his own configuration file.
So what you’ll need is :
Config file for domain1.com located in
/etc/nginx/sites-available/
and another in the same direction for domain2.com
That would mean you have two config files in
/etc/nginx/sites-available/
-/etc/nginx/sites-available/domain1.conf
/etc/nginx/sites-available/domain2.conf
Now to enable your config files you need to execute:
Restart Nginx and that’s it.