Nginx configure virtual machine

WBOY
Release: 2016-08-08 09:21:41
Original
795 people have browsed it

Window下配置:

server {

     listen      80;
     server_name blog.com www.blog.com;
     root        E:/phpStudy/WWW/yii_blog/3 ;
     location / {
         index   index.html index.php;
     }
     location ~* .(gif|jpg|png)$ {
         expires 30d;
     }
     location ~ .php$ {
         fastcgi_pass  localhost:9000;
         fastcgi_param SCRIPT_FILENAME
                       $document_root$fastcgi_script_name;
         include       fastcgi_params;
     }

}  

Linux下配置:

server{

       listen 80;

       root /home/user/website/www;

       index index.php index.html index.htm;

       server_name localhost;

       location / {

           try_files $uri $uri/ /index.php;

       }

       location ~ .php$ {

           fastcgi_pass 127.0.0.1:9000;

           fastcgi_index index.php;

           fastcgi_param SCRIPT_FILENAME /home/user/website/www$fastcgi_script_name;

                                                                                   Copyright Statement: This article is the original article of the blogger and may not be reproduced without the permission of the blogger. .

The above introduces Nginx configuration virtual machine, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!