nginx如何配置多站点
2010-10-21 19:18
387 查看
其实跟apahce差不多。打开nginx的主配置文件nginx.conf,在最后面加以句:
include /etc/nginx/vhosts/*;
vhostsl里面存放着不同站点的配置,把本博客的例子贴上来:
include /etc/nginx/vhosts/*;
vhostsl里面存放着不同站点的配置,把本博客的例子贴上来:
server {
listen 80;
server_name i.cteabox.com;
location / {
root /var/www/tea/blog;
index index.php index.html index.htm;
if (-d $request_filename){
rewrite ^/(.*)([^/])$ $1$2/ permanent;
}
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/tea/blog;
}
# 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 /var/www/tea/blog$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
里面包括nginx的rewirte
listen 80;
server_name i.cteabox.com;
location / {
root /var/www/tea/blog;
index index.php index.html index.htm;
if (-d $request_filename){
rewrite ^/(.*)([^/])$ $1$2/ permanent;
}
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/tea/blog;
}
# 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 /var/www/tea/blog$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
里面包括nginx的rewirte
相关文章推荐
- Nginx一个IP如何配置多个站点的方法教程
- 什么是ssl证书,什么是https,nginx如何配置ssl证书,兼容https与http同时访问站点
- VPS Nginx + Tornado 的多站点配置参考
- Nginx 配置多站点vhost 的方法
- 使用nginx配置android文档本地站点
- Nginx实战基础篇五 如何让用户通过用户名密码认证访问我们的web站点
- 在R5中如何将一个Domino Web服务器配置为多个Web站点--虚拟服务器
- 了解如何将 Nginx 配置为Web服务器
- nginx 多域名配置 (nginx如何绑定多个域名)
- Nginx实现多个站点使用一个端口(配置Nginx的虚拟主机)
- nginx配置多个站点共用80端口的解决方法
- 在nginx中配置如何防止直接用ip访问服务器web server及server_name特性讲解
- centOS下的nginx1.8.0多站点配置(同一IP,不同端口)
- 如何配置Nginx+Fastcgi实现控制硬件
- 在nginx中配置如何防止直接用ip访问服务器web server及server_name特性讲解
- 如何找出nginx配置文件的所在位置?
- PHP+Apache如何监控多个端口和配置多站点
- 如何在nginx服务器上创建第二个网站站点,更多站点以此类推
- 如何使用 Apache Web 服务器配置多个站点
- 在nginx中配置如何防止直接用ip访问服务器web server及server_name特性讲解