老哥最近在研究PHP ,項目經理要我從wnmp開始搭建,搭建過程中遇到了很多坑。。這裏就不一一敘述了。其中nginx是第一次接觸,詳細配置文件如下:
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root D:/nginx/html/medi;
index index.php index.html index.htm;
if (!-f $request_filename){
rewrite ^/(.*)$ /index.php?s=$1 last;
break;
}
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root D:/nginx/html/medi;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
Nginx基本配置(PHP)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
Django學習隨手記(七)
ZSC_LM
2018-08-27 19:45:51
ThinkCMF配置URL
ZSC_LM
2018-08-27 19:45:48
nginx+php-fpm訪問報錯,顯示access denied
ZSC_LM
2018-08-27 19:45:48
MongoDB之PHP的使用(GridFs)
爱在拜城_sunbea
2018-08-27 20:02:39
mongodb php之limit查詢技巧
爱在拜城_sunbea
2018-08-27 20:02:03
使用WampServer搭建本地PHP環境,綁定域名,配置僞靜態
stoneson
2018-08-27 19:48:49
關於下載PHP時候遇到的分類
zcy6675
2018-08-27 19:48:04
微信網頁開發常用功能封裝
m249005779
2018-08-27 19:47:09
ThinkPHP微信JSSDK的使用
m249005779
2018-08-27 19:47:09
composer
m249005779
2018-08-27 19:47:09
在homestead下創建laravel/lumen項目
雅希
2018-08-27 19:45:07
Windows下安裝homestead常見問題詳解
雅希
2018-08-27 19:45:04
24小時熱門文章