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的虚拟主机
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章