Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Can the Localhost Listen to Multiple Ports?

$
0
0
Hello,
I'm rather new to Nginx and web servers in general, so please bear with me!

The project I am working on, I am trying to create a reverse proxy with Nginx. However, rather than it being a reverse proxy to Apache, I am looking for it to do so for static and dynamic Nginx servers. I'm under the impression that I can do this (if not something similar) by having different virtual hosts listening at different ports, so that I may proxy_pass from my initial server to the static and dynamic ones respectively.

I am currently trying to get Nginx virtual hosts to listen to multiple ports at the same time, yet having no luck. I had followed the steps listed here:
http://rajibpaudyal.com/nginx-in-multiple-ports-in-same-localhost
explaining how to duplicate your project in different virtual hosts, yet when I try to access localhost:81, localhost:82, etc, it acts as if the page doesn't exist. (Typical Chrome/Firefox "We cannot make a connection at this server..." message.)

My nginx.conf file regarding the server and listening:

server {
listen 80;
server_name localhost;
root html;
index index.html index.htm;
}

I have also tried putting in other server blocks listening to different ports with no avail.
I do reload Nginx before I test it every time.

I'm running this on Fedora 18 with Arch Linux.

If anyone could point me in the right direction, I'd super appreciate it! I feel like there must be a very obvious solution I am missing, or that I am misunderstanding what I am trying to accomplish.

Thanks.

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>