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 www.example.com, page loads from /usr/local/www/page1
- if theres a connection on port 443 and the url is secure.example.com, page loads from /usr/local/www/page2
if however I type https://www.example.com (note the https) I don't get a page not found error, or some other error. I'm actually redirected to https://secure.example.com
Because there is no server named www.example.com for port 443 I'm confused...?
What am I doing wrong...
would love feedback...
server {
listen 80 default;
server_name www.example.com;
root /usr/local/www/page1;
...
}
server {
listen 443 default;
server_name secure.example.com;
root /usr/local/www/page2;
....
}