发布于 2016-01-05 04:24:36 | 359 次阅读 | 评论: 0 | 来源: PHPERZ
Nginx WEB服务器
Nginx 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器。 Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru 站点开发的,第一个公开版本0.1.0发布于2004年10月4日。其将源代码以类BSD许可证的形式发布,因它的稳定性、丰富的功能集、示例配置文件和低系统资源的消耗而闻名。
server
{
listen 80;
server_name www.test1.com www.aaa1.com www.bbb1.com;
if ($host != 'www.test1.com')
{
rewrite ^/(.*)$ http://www.test1.com/$1 permanent;
}
index index.html index.htm index.php;
root /data/www;
access_log /tmp/access.log 123123;
location ~ .*admin\.php$ {
auth_basic "123123 auth";
auth_basic_user_file /usr/local/nginx/conf/.htpasswd;
include fastcgi_params;
fastcgi_pass unix:/tmp/www.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name;
}
* location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
* {
* access_log off;
* expires 30d;
* }
location ~ .*\.(js|css)
{
access_log off;
expires 12h;
}
location ~ .*\.(static|cache)$
{
access_log off;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/tmp/www.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name;
}
}