1、一般nginx安裝完之後便是配置檔案了,主配置檔案nginx.conf 就修改2個地方
listen 80; #監聽端口
2、每配置一個網站就在/etc/nginx/conf.d/目錄下建立相關的配置檔案如下内容
server {
listen 80; #監聽端口
#autoindex on; #這個是開啟浏覽網站的目錄顯示,建議關閉off
root /source/boke/public; 這個網站根目錄
index index.php index.html index.htm;
charset utf-8;
access_log /var/log/nginx/bp.hldcanyin.com.access.log main;
error_log /var/log/nginx/bp.hldcanyin.com.error.log debug;
location / {
#try_files $uri $uri/ /index.php?_url=$uri&$args;
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php {
# try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index /index.php;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
location ~ /\.ht {
deny all;
}
以上有問題歡飲補充,這裡隻做簡單展示!謝謝!
本文轉自xinrenbaodao 51CTO部落格,原文連結:http://blog.51cto.com/11832904/1961380,如需轉載請自行聯系原作者