I currently have an nginx VM setup to route traffic between 3 domains but am having an issue with routing the subdomains at the moment. The current configuration goes PFSense -> nginx reverse proxy -> apache2. I am able to access the root domain fine but any time I enter a subdomain I am routed to the root instead.
Here is my server block configuration, there are some additional items in there because I need to be able to handle websockets as well.
server
{
listen 80 default_server;
server_name .mydomain.com;
location /
{
proxy_pass http://<internal_server>;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
server
{
listen 443 default_server;
server_name .mydomain.com;
ssl_certificate /etc/nginx/secure/nproxy.crt;
ssl_certificate_key /etc/nginx/secure/nproxy.key;
ssl on;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_protocols TLSv1.2;
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/secureproxy.log;
location /
{
proxy_pass http://<internal_server>;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}