Linux under Nginx configuration virtual Host

Source: Internet
Author: User

After getting the new server and installing everything, I started to configure a new site test, but the problem followed, mainly the site was set up successfully, but does not support PHP.
Nginx configuration site is actually based on an IP multi-site.
Then create a new configuration file in the configuration directory with the same name as the site name, and then write:

server {listen 80;    server_name www.piyaoyan.com piyaoyan.com;    Access_log/var/log/nginx/piyaoyan.com/access.log main;    root/home/akcms/domains/piyaoyan.com/www;     Index index.html index.htm index.php;    Rewrite ^/$/akcms_item.php?id=1 last;    Rewrite ^/rss.xml$/akcms_item.php?id=6 last;    Rewrite ^/index.html$/akcms_item.php?id=1 last;    Rewrite ^/index-([0-9]+). htm$/akcms_item.php?id=1&page=$1 last;    Rewrite ^/index-([0-9]+). html$/akcms_item.php?id=1&page=$1 last;    Rewrite ^/yaoyan/([0-9]+). html$/akcms_item.php?id=$1 last;    Rewrite ^/category/([0-9]+) \.html$/akcms_category.php?id=$1 last;      Rewrite ^/category/([0-9]+) \-([0-9]+] \.html$/akcms_category.php?id=$1&page=$2 last;        Location ~ \.php$ {Fastcgi_pass 127.0.0.1:9000;        Fastcgi_index index.php;        Fastcgi_param script_filename $document _root$fastcgi_script_name;    Include Fastcgi_params; }}

In this configuration write pseudo-static rules, support PHP is the following location ~\.pjp$.
After the configuration is finished to detect the correct configuration of Nginx, use nginx-t and then restart Nginx, using nginx-s reload
Access in the browser to see if it is possible to support PHP.
OK, not supported, then this will modify the configuration of the phpfastcgi, using the Ps-ef | grep php
Find the service, see where its profile is, and then edit it.
Here we need to modify the pool user and group users, and modify the user and group corresponding to the configuration file.
Restart this thing, restart it a bit of trouble, but also through the PID to restart: KILL-USR2 pid (that is, the main process ID) restart the service.

Linux under Nginx configuration virtual Host

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.