lnmp?
nginx配制虛擬域名
nginx默認(rèn)站點(diǎn)目錄是:/usr/share/nginx/html/
權(quán)限設(shè)置:chown nginx.nginx/usr/share/nginx/html/ -R
MySQL數(shù)據(jù)庫目錄是:/var/lib/mysql
權(quán)限設(shè)置:chown mysql.mysql -R?/var/lib/mysql
/etc/nginx/conf.d? 建立一個(gè) 虛擬域名 如:www.yii.cc.conf
配制內(nèi)容如下:
server {
listen? 80;
server_name? www.yii.cc;
index? index.php index.html;
#root /usr/share/nginx/html/basic/web;
root /usr/share/nginx/html/yii;
#access_log? /www/access_ example1.log? main;
location / {
if (!-e $request_filename){
rewrite ^/(.*) /index.php last;
}
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ .php$ {
fastcgi_pass?? 127.0.0.1:9000;
fastcgi_index? index.php;
fastcgi_param? SCRIPT_FILENAME? $document_root$fastcgi_script_name;
include??????? fastcgi_params;
}
location ~ /.ht {
deny? all;
}
}
第二:/etc/nginx?? => nginx.conf ??? 下面配制:?
# The default server is in conf.d/default.conf
?? include /etc/nginx/conf.d/*.conf;
重啟? nginx???
?1. /etc/init.d/nginx? restart
2.平滑重啟命令:kill -HUP 住進(jìn)稱號或進(jìn)程號文件路徑或者使用/usr/nginx/sbin/nginx -s reload注意咬摇,修改了配置文件后最好先檢查一下修改過的配置文件是否正 確,以免重啟后Nginx出現(xiàn)錯(cuò)誤影響服務(wù)器穩(wěn)定運(yùn)行潘懊。判斷Nginx配置是否正確命令如下:
nginx -t -c /usr/nginx/conf/nginx.conf或者/usr/nginx/sbin/nginx -t
3.nginx? reload重啟執(zhí)行# /usr/local/nginx/sbin/nginx -s reload?nginx已經(jīng)重啟成功用root權(quán)限 重啟#killall nginx#nginx
4.Ubuntu?Nginx$sudo service nginx start$sudo service nginx stop