1

Right, so I have this folder: /home/sites/dev/testphp/ inside this folder there's an index.php file, with a simple echo line. I also have a /home/sites/dev/testhtml/ with an index.html file.

When I visit http://testhtml.dev.ilun.no/ it works as expected. But when I visit http://testphp.dev.ilun.no/ I simply get "No input file specified."

This is my config so far:

server {
    listen 80;
    server_name dev.ilun.no www.dev.ilun.no;
    root /home/sites/dev;
    index index.php index.html;
}

server {
    listen 80;
    server_name ~^(.*)\.dev.ilun\.no$;
    root /home/sites/dev/$1;
    index index.php index.html;
    if (!-d /home/sites/dev/$1) {
        rewrite . http://dev.ilun.no/ redirect;
    }
    location ~ .php$ {
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
    }
}

I'm completely stuck on this, and can't figure it out yet. Any suggestions?

1 Answer 1

2

Dynamic root is tricky thing, try other regexp:

server_name  ~^(?P<subdomain>.+)\.dev.ilun\.no$;
root /home/sites/dev/$subdomain;
Sign up to request clarification or add additional context in comments.

1 Comment

Massive internet-hug to you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.