一、通常nginx安裝完以後即是配置文件了,主配置文件nginx.conf 就修改2個地方php
listen 80; #監聽端口html
server_name www.boke.com; #虛擬主機域名或者IP地址nginx
二、每配置一個網站就在/etc/nginx/conf.d/目錄下創建相關的配置文件以下內容ide
server {網站
listen 80; #監聽端口url
server_name www.boke.com; # 虛擬主機域名或者IP地址spa
#autoindex on; #這個是開啓瀏覽網站的目錄顯示,建議關閉offdebug
root /source/boke/public; 這個網站根目錄orm
index index.php index.html index.htm;server
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;
}
}
以上有問題歡飲補充,這裏只作簡單展現!謝謝!