Nginx忽略位置

时间:2014-11-17 07:01:01

标签: nginx

地点有问题。

我们需要按要求这样做:

http://domain.com通过/ var / www / domain / main / web

打开网站

http://domain.com/job通过/ var / www / domain / job / web

打开网站

试试这个配置:

server {
   listen                *:80;

   server_name           domain.com;

   access_log            /var/log/nginx/domain.com.access.log;
   error_log             /var/log/nginx/domain.com.error.log;

   location /job/ {
       root  /var/www/domain/job/web;
       try_files  $uri  $uri/  /index.php?$args;
       index  index.html index.htm index.php;

       location ~ \.php$ {
           root  /var/www/domain/job/web;
           try_files  $uri  $uri/  /index.php?$args;
           index  index.html index.htm index.php;
           fastcgi_index index.php;
           fastcgi_param PATH_INFO $fastcgi_path_info;
           fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
           fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
           fastcgi_param APP_ENV dev;
           fastcgi_pass unix:/var/run/php5-fpm.sock;
           fastcgi_split_path_info ^(.+\.php)(/.+)$;
           include fastcgi_params;
       }
  }

  location / {
      root  /var/www/domain/main/web;
      try_files  $uri  $uri/  /index.php?$args ;
      index  index.html index.htm index.php;

      location ~ \.php$ {
          root  /var/www/domain/main/web;
          try_files  $uri  $uri/  /index.php?$args;
          index  index.html index.htm index.php;
          fastcgi_index index.php;
          fastcgi_param PATH_INFO $fastcgi_path_info;
          fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          fastcgi_param APP_ENV dev;
          fastcgi_pass unix:/var/run/php5-fpm.sock;
          fastcgi_split_path_info ^(.+\.php)(/.+)$;
          include fastcgi_params;
     }
  }
}

位置/工作/不工作,在/

中打开网站

0 个答案:

没有答案