I'm planning to serve blog.mydomain.com on the same server with my node.js app called mydomain.com.
Is it possible to run these together on the same server ? How can I do that with the usage of Nginx ? Can wordpress and node.js app have the same port if they run together ? It would be great if someone give me a hint to start or any share any resources for me to read.
Create two different nginx conf files for main domain and subdomain like:
1.For main domain which will proxy pass to your node app running on 1234 port
/etc/nginx/sites-enabled/mydomain.com -
server { server_name mydomain.com; access_log /var/log/nginx/mydomain.access.log; error_log /var/log/nginx/mydomain.error.log; location / { proxy_pass http://localhost:1234; } }
/etc/nginx/sites-enabled/blog.mydomain.com -
server { server_name mydomain.com;
access_log /var/log/nginx/mydomain.access.log; error_log /var/log/nginx/mydomain.error.log; location / { proxy_pass http://localhost:5678; } }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.