nginx+php部署关于nginx.conf配置问题,请教熟悉的朋友

WBOY
Release: 2016-06-02 11:28:11
Original
1232 people have browsed it

phpnginx.conf

我使用的lnmp包安装的,安装提示成功。也能正常访问phpinfo页面。
把自己项目放上去后,更改了php.ini的doc_root 改为项目地址;然后就是nginx改成以下:
user root;
worker_processes auto;
error_log /home/wwwlogs/nginx_error.log crit;
pid /usr/local/nginx/logs/nginx.pid;

#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;

events
{
use epoll;
worker_connections 51200;
multi_accept on;
}

http
{
include mime.types;
default_type application/octet-stream;

<code>    server_names_hash_bucket_size 128;    client_header_buffer_size 32k;    large_client_header_buffers 4 32k;    client_max_body_size 50m;    sendfile   on;    tcp_nopush on;    keepalive_timeout 60;    tcp_nodelay on;    fastcgi_connect_timeout 300;    fastcgi_send_timeout 300;    fastcgi_read_timeout 300;    fastcgi_buffer_size 64k;    fastcgi_buffers 4 64k;    fastcgi_busy_buffers_size 128k;    fastcgi_temp_file_write_size 256k;    gzip on;    gzip_min_length  1k;    gzip_buffers     4 16k;    gzip_http_version 1.1;    gzip_comp_level 2;    gzip_types     text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss;    gzip_vary on;    gzip_proxied   expired no-cache no-store private auth;    gzip_disable   "MSIE [1-6]\.";    #limit_conn_zone $binary_remote_addr zone=perip:10m;    ##If enable limit_conn_zone,add "limit_conn perip 10;" to server section.    server_tokens off;    #log format    log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '         '$status $body_bytes_sent "$http_referer" '         '"$http_user_agent" $http_x_forwarded_for';    access_log off;</code>
Copy after login

upstream OfficeFPM {
server 127.0.0.1:8266 weight=1;
keepalive 100;
}
server
{
listen 81 default_server;
server_name localhost;
index index.html index.php;
root /home/wwwroot/default;

<code>    #error_page   404   /404.html;    include enable-php.conf;    if (-d $request_filename){rewrite ^/(.*)([^/])$ $scheme://$http_host/$1$2/ permanent;}    #charset gbk;    #access_log  logs/host.access.log  main;    location ~* ^/(attachment|static|images|theme|templates|wav)/.*\.(php|.php3|.php5|jsp|asp)$ {        deny all;    }    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:8266    #    location ~ \.php$ {        fastcgi_pass   OfficeFPM;        fastcgi_index  index.php;        include        fastcgi.conf;    }    location  /general/document/index.php/ {        fastcgi_pass  OfficeFPM;        fastcgi_index  index.php;        include        fastcgi.conf;        fastcgi_param  SCRIPT_FILENAME   /home/wwwroot/default/general/document/index.php;        fastcgi_param  SCRIPT_NAME       /general/document/index.php;        fastcgi_split_path_info          ^(.+\.php)/(.*)$;        fastcgi_param  PATH_INFO         $fastcgi_path_info;        fastcgi_param PATH_TRANSLATED    $document_root$fastcgi_path_info;    }    location /general/itask/router.php/ {        fastcgi_pass   OfficeFPM;        fastcgi_index  index.php;        include        fastcgi.conf;        fastcgi_param  SCRIPT_FILENAME   /home/wwwroot/default/general/itask/router.php;        fastcgi_param  SCRIPT_NAME       /general/itask/router.php;    }        location ~* ^/attachment/(background|im|new_sms|reportshop|cache|data_center) {        allow all;    }    location ~* ^/attachment {        deny all;    }    location ~ /\.    {        deny all;           }   location / {      if (!-e $request_filename){             rewrite ^/(.*) /index.php last;         }    }    access_log  /home/wwwlogs/access.log  access;}</code>
Copy after login

include vhost/*.conf;
}

当时访问出现如下图错误,index.php报错
图片说明
当我改成静态页面时候却能正常访问,请教了,本人第一次搞这个对这些配置文件很模糊,请高手帮忙改下。

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!