Welcome! Log In Create A New Profile

Advanced

Nginx Server Directive Config

Posted by cmdlinegeek 
Nginx Server Directive Config
September 30, 2014 01:48PM
I have a webserver that hosts 15 vhosts, all are listening on port 80. I'm in the process of adding another vhost, except this one is listening on both 80 and 443. However, when I add the second server directive for the SSL port and restart the nginx server, it doesn't load the correct vhost. It appears to load the last vhost in ascii order from the /etc/nginx/sites-available/*

If I remove the server directive referencing port 443, the correct vhost website is restored. I cannot figure out why this is happening. Any help would be greatly appreciated, thanks.

vhost-config
[code]
server {
listen 443 ssl default_server;
server_name *.website.com;

root /var/www/vhost/www.website.com/public_html/httpdocs/;
index index.php;

ssl_certificate /etc/nginx/ssl/www.website.com/website.com.crt;
ssl_certificate_key /etc/nginx/ssl/www.website.com/website.com.key;


location / {
try_files $uri $uri/ /index.php?$args;
}

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_hide_header X-Powered-By;
}

}
[/code]
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 230
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