I have a VPS server and try to install Apache and Nginx to work together in Ubuntu 16.04 but with different server Names and domains.
So, I have apache to port 8000 and nginx to port 8080.
Nginx do go to 8080 port because use NodeJs and this uses behind the route https://localhost:8080/
Apache uses Laravel 5.5 and PHP.
I have already configure to Apache
/etc/apache2/sites-available/000.default.conf
<VirtualHost *:8000>
ServerName www.myanotherdomainname.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/laravel/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
/ect/apache2/ports.conf
with Listen 8000
For Nginx in /etc/nginx/sites-available/default
location / {
proxy_pass http://localhost:8080;
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;
}
And
server {
if ($host = www.mydomain.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = mydomain.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 default_server;
listen [::]:80 default_server;
server_name geckode.la www.mydomain.com;
return 404; # managed by Certbot
}
In www.mydomain.com, the script.js run by NodeJs works fine
But in www.myanotherdomainname.com, return 404 Not Found nginx/1.10.3 (Ubuntu)
It doesn't even seem to run apache
I need to know the best way to run apache and nginx with Nodejs.
Apache status and Nginx are running without any problem.
Thanks