Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My requirements:
My website -> - Runs Magento ecommerce platform built in PHP running under Nginx server (currently Apache but very soon moving to Nginx)
Another website -> - abcd is currently another website that runs on ASP.NET
Another website -> - xyz is currently another website that runs on ASP.NET

I want to co-exist PHP and ASP.NET website on 1 server with the ASP.NET websites running as a sub-folder.

1. The Magento website is an ecommerce website which cannot be re-built.
2. The ASP.NET is a corporate website that is investing money into the ecommerce website and it cannot be re-built either since they have many corporate websites and each which will run as sub-folder to the magento website.

Looked briefly at mono-project. However from my understanding you need to have separate domains and separate folders for the PHP and ASP.NET to exist on 1 server? Or is my understand wrong?

Can anyone over here provide me more information on whether this can be done. If so, what direction do I need to look into? As mentioned in the requirements, I cannot re-build (though can make minor changes) any of the corporate website into PHP as they have already been done and they are many of them. Also I know I can put a sub-domain and make it point to another server with IIS but the corporates want that as the very last option.

My background is as a PHP developer so I have very little understanding of ASP.NET. So please be gentle :)

share|improve this question
up vote 0 down vote accepted

I'm not real familiar with Mono, but looking at the nginx configuration for it (Mono under nginx fastcgi), it should be possible to run both PHP-FPM and Mono through nginx using your described setup, using a config such as:

server {
    listen 80;

    // PHP
    location / {
        index          index.php;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
        fastcgi_pass   localhost:9000; // php server/port

    // ASP.NET 1
    location /abcd {
        index          Default.aspx;
        fastcgi_index  Default.aspx;
        include        fastcgi_params;
        fastcgi_pass   localhost:9001; // mono server/port

    // ASP.NET 2
    location /xyx {
        index          Default.aspx;
        fastcgi_index  Default.aspx;
        include        fastcgi_params;
        fastcgi_pass   localhost:9002; // other mono server/port

You would then have to set different root for each location block.

share|improve this answer
I think this should be it. Will be implementing this next month so in case I run into any trouble will post back here.I don't think I have enough rep to up your answer! But thanks for pointing me in a particular direction :) – Harshit Nov 6 '12 at 11:47

I'm not intimately familiar with how to run Mono in nginx and I don't want to spread FUD, but I'm not sure that setup is absolutely mature.

If you can, you might want to consider running everything in IIS on Windows Server. IIS has excellent PHP support and IIS has support for running separate in the subfolders in the way that you need. There's more info here.

share|improve this answer
Magento is extremely resource intensive and has not been designed to work efficiently with IIS or Apache-Windows. It works ok for Apache but for millions of site users nginx can handle this best. So unfortunately I can't move all of them to IIS. If I can install IIS and Apache on 1 linux server & run main folder off Apache and the sub-folder off IIS then I'm ok too. – Harshit Oct 24 '12 at 10:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.