linux(centos5.5)/windows下nginx開啟phpinfo模式功能的配置方法分享
經(jīng)過志文工作室測(cè)試有效的相關(guān)配置主要內(nèi)容如下:
location ~ \.php(.*)$ {
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
#include fastcgi_params;
include fcgi.conf;
}
一個(gè)完整的站點(diǎn)配置示例:
log_format v.lzw.me '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
server {
listen 80;
server_name v.lzw.me;
index index.html index.htm index.php default.html default.htm default.php;
root /www/v.lzw.me;
# urlrewrite
include v.lzw.me.conf;
location ~ \.php(.*)$ {
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
#include fastcgi_params;
include fcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
}
location ~ .*\.(js|css)?$ {
expires 12h;
}
access_log /wwwlogs/v.lzw.me.log v.lzw.me;
}
其他方法參考(適合windows下的nginx等):
location ~ \.php
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
}
- 在Linux和Windows系統(tǒng)上安裝Nginx服務(wù)器的教程
- Linux下nginx編譯安裝教程和編譯參數(shù)詳解
- Linux環(huán)境下nginx搭建簡(jiǎn)易圖片服務(wù)器
- Linux+Nginx+Php架設(shè)高性能WEB服務(wù)器
- Windows下Nginx+PHP5的安裝與配置方法
- windows安裝nginx部署步驟圖解(反向代理與負(fù)載均衡)
- Nginx+Windows負(fù)載均衡配置方法
- windows使用nginx實(shí)現(xiàn)網(wǎng)站負(fù)載均衡測(cè)試實(shí)例
- 批處理代碼搞定Windows下Nginx+PHP(FastCGI)管理
- PHP程序員玩轉(zhuǎn)Linux系列 Linux和Windows安裝nginx
相關(guān)文章
Nginx配合php實(shí)現(xiàn)生成實(shí)時(shí)縮略圖功能
這篇文章主要介紹了Nginx配合php實(shí)現(xiàn)生成實(shí)時(shí)縮略圖功能,這在一些特殊場(chǎng)合可能會(huì)要用到,需要的朋友可以參考下2014-10-10
如何通過nginx負(fù)載均衡跳轉(zhuǎn)https
這篇文章主要介紹了如何通過nginx負(fù)載均衡跳轉(zhuǎn)https的相關(guān)資料,需要的朋友可以參考下2018-09-09
詳解Nginx 利用代理轉(zhuǎn)發(fā)請(qǐng)求示例
這篇文章主要介紹了詳解Nginx 利用代理轉(zhuǎn)發(fā)請(qǐng)求示例,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2018-03-03

