Serving PHP from an Nginx Alias

Solution 1:

Okay, so I may have found my own answer by brute force trial and error once I incorporated @quanta's info (see comments above). This virtual host server block seems to serve PHP and static content properly:

server {
  listen      443 default_server ssl;
  server_name dev.myproject.mydomain.net;
  root        /opt/dev/project-root;
  index       index.php;

  ssl_certificate      /etc/ssl/certs/server.crt;
  ssl_certificate_key  /etc/ssl/certs/server.pem;

  access_log /var/log/nginx/myproject.dev.access.log;
  error_log  /var/log/nginx/myproject.dev.error.log;

  location ~ ^/alias_name/(.+\.php)$ {
    alias /opt/dev/project-root/www/$1;
    include /etc/nginx/conf/php;
  }
  location ~ ^/alias_name/(.*) {
    alias /opt/dev/project-root/www/$1;
  }

  location ~ \.php$ {
    include /etc/nginx/conf/php;
  }
}

I don't know whether I'll bump into problems and I can't say that I fully understand the difference, but simply removing the nested location blocks seems to have done the trick.