NginxAlias cannot resolve the PHP solution-php Tutorial

Source: Internet
Author: User
NginxAlias cannot parse PHP solution: server {??????? Listen ?????? 80 ;??????? Server_name? Xxxx.com.cn ;??????? Error_log? Tmperor. log ;??????? Set $ www_root Nginx Alias solution for failing to parse PHP

Nginx Alias cannot parse PHP solution:

Server {
??????? Listen ?????? 80;
??????? Server_name? Xxxx.com.cn;


??????? Error_log? /Tmp/eror. log;
??????? Set $ www_root/home/web/yqbb/bgskk;


??????? Location /{
??????????? Root ?? $ Www_root;
??????????? Index? Index.html index. php;
??????? }


??????? Location/feedback {
??????????? Index? Index. php;
??????????? Alias/home/web/yqbb/bgskk/app/htdocs;
??????? }


??????? Error_page ?? 500 502 503 504? /50x.html;
??????? Location =/50x.html {
??????????? Root ?? Html;
??????? }


??????? Location ~ ^/Feedback/. + \. php $ {
??????????????? Root/home/web/yqbb/bgskk/app/htdocs;
??????????????? Rewrite/feedback/(. * \. php ?) /$1 break;
??????????????? Include fastcgi. conf;
??????????????? Fastcgi_pass ?? 127.0.0.1: 9000;
??????????????? Fastcgi_index? Index. php;
??????????????? Fastcgi_param SCRIPT_FILENAME/home/web/yqbb/bgskk/app/htdocs/$ fastcgi_script_name;
??????? }


??????? Location ~ . * \. (Php | php5 )? $ {
??????????????? Fastcgi_pass? 127.0.0.1: 9000;
??????????????? Fastcgi_index index. php;
??????????????? Include fastcgi. conf;
??????? }


??? }


?

?

Server
??? {
??????? Listen 80 ;? # Port number
??????? Server_name www.linuxidc.com ;?? # Domain name
??????? Index index.html index.htm index. php index.shtml ;? # Default homepage
??????? Root? /Var/www/html ;? # Website root directory
??????? Charset gbk ;??? # Default encoding

??????? Location/public /? # Set the directory name to be overwritten
??????? {
??????????????? Alias/var/www/public/; # redirect destination directory.

??????????????? # Example: If the user access the http://www.linuxidc.com/public/test.html will not access/var/www/html/public/test.html, while the access is/var/www/public/test.html, although this file is not in the domain name Directory
??????? }

# After completing the above settings, we found that accessing the php file ghost

# Start


??????? Location ~ ^/Public/. + \. php $
??????? {
??????????????? Root/var/www/html/web/news/public;
??????????????? Rewrite/public/(. * \. php ?) /$1 break;
??????????????? Include fastcgi. conf;
??????????????? Fastcgi_pass ?? 127.0.0.1: 9000;
??????????????? Fastcgi_index? Index. php;
??????? }

# End


??????? Location ~ . * \. (Php | php5 )? $
??????? {
??????????? # Fastcgi_pass? Unix:/tmp/php-cgi.sock;
??????????? Fastcgi_pass? 127.0.0.1: 9000;
??????????? Fastcgi_index index. php;
??????????? # Include fcgi. conf;
??????????? Include fastcgi. conf;
??????????? Rewrite? ^/([A-zA-Z] +) \/([a-zA-Z] +) $/listen 2.shtml last;
??????? }

??????? Location ~ . * \. (Gif | jpg | jpeg | png | bmp | swf) $
??????? {
??????????? Expires ????? 30d ;? # Cache for 30 days
??????? }

??????? Location ~ . * \. (Js | css )? $
??????? {
??????????? Expires ????? 1 h; # cache for 1 hour
??????? }

??????? Access_log? /Var/log/linuxidc. log? Access ;? # Define log files
??????? Ssi on;
??????? Ssi_silent_errors on;
??????? Ssi_types text/shtml;
??? }

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.