I want to run multiple sites on the same domain, using nginx, but on different ports and want them all to use SSL
Let's say,
I have two sites siteone.com
and sitetwo
in the directory /var/www/
as follows:
/var/www/siteone.com/ /var/www/sitetwo/
I want to host siteone.com
on the domain https://siteone.com and sitetwo
on the same domain but on a different port, say https://siteone.com:8080
Note: having SSL
on both sites is important.
It might sound like I'm over engineering stuff here, but I still want to know if it is possible to do so? I'm using nginx
web server. What would my nginx conf file look like?
I had tried using the following but it didn't work:
server { listen 443; server_name siteone.com; root /var/www/; # ssl stuff here } server { listen 8080; server_name sitetwo; root /var/www/; # ssl stuff here } server { listen 80; server_name siteone.com; return 301 https://$host$request_uri; }
server_name
forsite_two
also tositeone.com
and let nginx do the mapping based on the port. What does "it didn't work" mean? Please add error messages and log file entries to your post.