Learn about Centmin Mod LEMP Stack today
Register Now

Nginx subdomain display 404?

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by jellday, Mar 30, 2016.

  1. jellday

    jellday New Member

    26
    2
    3
    May 31, 2014
    Ratings:
    +3
    Local Time:
    9:13 PM
    1.4.6
    5.5
    Code:
    server {
            server_name *.mydomainname.info;
            if ( $host ~* (\b(?!www\b)\w+)\.\w+\.\w+ ) {
                   set $subdomain /$1;
             }
            location / {
                    root /home/nginx/domains/mydomainname.info/public$subdomain;
                    index index.html index.php;
             }
            location ~ ^/(ads|d|e|skin)/
                    {
                    proxy_redirect        off;
                    proxy_set_header    Host   www.mydomainname.info;
                    proxy_pass      http://127.0.0.1:80;
                    }
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/php.conf;
      include /usr/local/nginx/conf/drop.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    
      if ($http_user_agent ~* "(YisouSpider|EasouSpider|EtaoSpider)") {
       return 403;
      }
        }
    some subdomain is all right, but some are not.
    It seems to me that if the index file is index.html, then subdomain.mydomain.info is all right
    if the index file is index.php, then shows 404 error. Don't know why
     
  2. eva2000

    eva2000 Administrator Staff Member

    28,972
    6,575
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,759
    Local Time:
    11:13 PM
    Nginx 1.13.x
    MariaDB 5.5
    Centmin Mod is provide as is, so short of scripted related bugs or issues, any further optimisation to the web stack components - nginx, php-fpm, mariadb mysql, csf firewall etc or web app specific configurations are left to the Centmin Mod user to deal with. So I do not provide any free support for such.

    However, Centmin Mod users are free to help each other out and ask questions or give answers on this community forum. My hopes are that this community forum evolves so that more veteran long time Centmin Mod users help new Centmin Mod users out :)

    any clues in your access.log and error.log in vhost listed paths at
    Code (Text):
    access_log /home/nginx/domains/domain.com/log/access.log combined buffer=256k flush=60m;
    error_log /home/nginx/domains/domain.com/log/error.log;
    


    Not sure but try moving the root path out of root / to server context ?
    Code (Text):
    root /home/nginx/domains/mydomainname.info/public$subdomain;
     
    • Like Like x 1