Trouble Understanding IP:PORT / Servername
August 27, 2012 08:23PM
New to nginx. Thought I understood the server config, but I don't think I do, was hoping someone could clarify for me in baby speak :)

How I thought the following code worked is as follows:
- if theres a connection on port 80 and the url is, page loads from /usr/local/www/page1
- if theres a connection on port 443 and the url is, page loads from /usr/local/www/page2

if however I type (note the https) I don't get a page not found error, or some other error. I'm actually redirected to

Because there is no server named for port 443 I'm confused...?

What am I doing wrong...

would love feedback...

server {
listen 80 default;

root /usr/local/www/page1;

server {
listen 443 default;

root /usr/local/www/page2;
Re: Trouble Understanding IP:PORT / Servername
September 22, 2012 03:37PM
Don't know the answer to this but try setting the level of the error log to debug. This helped me many times.
Re: Trouble Understanding IP:PORT / Servername
October 04, 2012 01:51PM
It can't exactly come up with a "page not found" error if there IS a page at, nor can it load on port 443 since https defaults to 443 and is only listening to port 80.

I'd imagine it should come up with an internal server error instead, unless nginx is designed such that, in a situation like this, it will default to the only site on port 443 when you try to use https on a site on port 80 (and you don't specify port 80, e.g.

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 326
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready