Nginx 配置虚拟机

来源:互联网 发布:组态王软件下载 编辑:程序博客网 时间:2024/06/05 10:00


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;
           include /etc/nginx/fastcgi_params;
       }
   }

0 0
原创粉丝点击