lamp和lnmp的虛擬主機的配置

lamp環境
基於端口的虛擬主機
基於域名的虛擬主機
基於ip的虛擬主機
lnmp環境
基於端口的虛擬主機
基於域名的虛擬主機
server {
#端口
listen 80;
#修改我們虛擬主機的域名
server_name wechat.zhaowei.shop;
#虛擬主機的站點
root /www;
#虛擬主機的訪問日誌
access_log /data/wwwlogs/access_nginx.log combined;
#站點下面的索引
index index.html index.htm index.php;
#error_page 404 /404.html;
#error_page 502 /502.html;
#nginx的狀態
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
#nginx對php文件的處理
location ~ [^/].php(/|$) {
#fastcgi_pass remote_php_ip:9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
#nginx對圖片的處理
location ~ ..(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
expires 30d;
access_log off;
}
#nginx對js文件和css文件的處理
location ~ .
.(js|css)?$ {
expires 7d;
access_log off;
}
location ~ ^/(.user.ini|.ht|.git|.svn|.project|LICENSE|README.md) {
deny all;
}
}
基於ip的虛擬主機
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章