I have 1 subdomain in addition to the main website, all running on nginx + fastcgi-mono-server4.
PROBLEM: I have to make the subdomain use a different port (port 81) for all the .conf/.webapp files or else when i visit subdomain.example.com, it always displays content for example.com instead. There seems to be a problem in my .webapp file. Displaying correct website works partially if I "hack" it and use port 81 for the subdomain: https://stackoverflow.com/questions/28872585/how-to-handle-multiple-websites-through-fastcgi-server
Below are nginx .conf files for each website:
##### SUBDOMAIN #####
server {
server_name subdomain.example.com;
root /subdomain;
listen 81;
location / {
fastcgi_index Default.aspx;
fastcgi_pass 127.0.0.1:9000;
include /opt/nginx/conf/fastcgi_params;
}
##### MAINWEBSITE #####
server {
server_name example.com;
root /mainwebsite;
listen 80;
location / {
fastcgi_index Default.aspx;
fastcgi_pass 127.0.0.1:9000;
include /opt/nginx/conf/fastcgi_params;
}
Next are the .webapp files required by fastcgi-mono-server4, (BOTH are in same folder /nginx/webapps):
##### SUBDOMAIN #####
<apps>
<web-application>
<name>subdomain</name>
<vhost>*</vhost>
<vport>81</vport>
<vpath>/</vpath>
<path>/subdomain</path>
</web-application>
</apps>
##### MAINWEBSITE #####
<apps>
<web-application>
<name>subdomain</name>
<vhost>*</vhost>
<vport>80</vport>
<vpath>/</vpath>
<path>/mainwebsite</path>
</web-application>
</apps>
To get the fastcgi-process started I run the following command:
fastcgi-mono-server4.exe --appconfigdir /nginx/webapps /socket=tcp:127.0.0.1:9000 /logfile=/opt/nginx/logs/fastcgi.log &