I'm setting up a blocks in nginx, but I'm having trouble running two separate apps, see the following situation:
- I have 2 apps (PHP and Node.js)
- just a domain (example.com) and need to point port 80 for the PHP application and 8080 for the node.js app.
- I've already done the PHP app pointing and it's ok, but I can not access the app node on the 8080
See my block file for php
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name exemplo.br;
# root directive should be global
root /var/www/app-php/public;
index index.php;
access_log /var/www/app-php/log/access.log;
error_log /var/www/app-php/log/error.log;
client_max_body_size 1024M;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht{
deny all;
}
}
And the block of node.js
server {
listen 8080;
location / {
proxy_pass http://localhost:3000;
# proxy_pass http://127.0.0.1:3000;
# proxy_pass http://IP-PRIVADO-SERVER:3000;
# proxy_pass http://exemplo.com.br:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host:8080;
# proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
Can anyone tell me what might be wrong, please?
Note: on the server that I am configuring nginx
does not have iptables
installed and I already tested the application node.js
on port 80
and it worked normal.