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;
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;
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;
#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;}
include vhost/*.conf;
}
當時訪問出現如錯誤,index.php報錯
當我改成靜態頁面時候卻能正常訪問,請教了,本人第一次搞這個對這些設定檔很模糊,請高手幫忙改下。