1

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

Background:
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.

Research:
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 http://abcd.example.com 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 :)

2 Answers 2

0

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;
    server_name example.com;

    // 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.

1
  • 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, 2012 at 11:47
0

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.

1
  • 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, 2012 at 10:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .