Nginx Configure the virtual domain name directly after the output or download the Web page source code instead of running the Web file solution

Source: Internet
Author: User

Reference Link: http://blog.csdn.net/iefreer/article/details/44293711

This problem is usually caused by an incorrect path to the Fastcgi_script_name access script.

Especially with subdirectories, for example, for YII frameworks, the path is usually project/web

Then if you access/project/index.php in the URL, then the script_name in the Nginx configuration will be the full path: project/index.php

If the code in your configuration is as follows:

Fastcgi_param script_filename $document _root$fastcgi_script_name;

Then the actual access to the file is/var/site_root/project/web/project/index.php, which is obviously not the result we want, we want to visit is/project/web/index.php.

These errors can be traced by looking at the Php-fpm.log (error log).

The workaround is to modify the appropriate path configuration.

The above is the original link.

After watching, I modified a place to be able to access the normal.

1 Location ~ \.php$ {2        root     /var/www/web; 3         fastcgi_pass   127.0.0.1:9000; 4         fastcgi_index  index.php; 5         fastcgi_param  script_filename  $document _root$fastcgi_script_name; 6         include        fastcgi_params; 7     }

The main is to modify Fastcgi_param this article.

Nginx Configure the virtual domain name directly after the output or download the Web page source code instead of running the Web file solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.