nginx配置域名跳转

nginx 配置主域名 xxx.com, 跳转子域名 www.xxx.com

server {
listen 80;
server_name www.xxx.com;

    location / {
        root   html/www/public_html;
        index  index.php index.html index.htm;
    }

    error_page  404              /404.html;

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html/www/public_html;
    }

    location ~ \.php$ {
        root           html/www/public_html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
       #  fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #  include        fastcgi_params;**
        include        fastcgi.conf;
    }

}

#xxx.com --> www.xxx.com
server {
server_name xxx.com;
rewrite ^(.*)$ http://www.xxx.com$1 permanent;
}

原文地址:http://blog.51cto.com/23426820/2177818

时间: 2024-10-17 19:56:15

nginx配置域名跳转的相关文章

Nginx配置域名跳转实例

要求:浏览器地址栏输入qj.123.com之后,地址自动变成qj.abc.com 配置nginx跳转 server { listen 80; server_name qj.abc.com qj.123.com; set $domain qj.abc.com; index index.php index.html index.htm; root /home/web/$domain/htdocs/; if ( $host = 'qj.123.com' ){ rewrite ^/(.*)$ http:

nginx 配置域名转发

自己测试环境,配置下载目录和一个jenkins的地址: 域名跳转,反向代理 # cat ../nginx.conf user www www; worker_processes 1; error_log logs/error.log info; pid logs/nginx.pid; worker_rlimit_nofile 65535; events { worker_connections 65535; use epoll; } http { include mime.types; defa

Apache配置域名跳转、日志切割、静态缓存、防盗链、访问控制

·/usr/local/apache2/bin/apachectl  -M:查看安装了哪些模块 ·/usr/local/apache/bin/apachectl   -V:查看使用的模式 ·/usr/local/apache2/bin/apachectl  -t:检查语法错误 ·/usr/local/apache2/bin/apachectl  -l:查看安装的库文件 ·/usr/local/apache2/bin/apachectl graceful:重新加载配置 ·/usr/local/ap

apache配置-域名跳转、日志切割、静态缓存、防盗链

·/usr/local/apache2/bin/apachectl -M:查看安装了哪些模块     ·/usr/local/apache2/bin/apachectl -t:检查语法错误 ·/usr/local/apache2/bin/apachectl -l:查看安装的库文件 ·/usr/local/apache2/bin/apachectl graceful:重新加载配置·/usr/local/apache2/htcocs         主页存放目录 ·/usr/local/apache

Nginx配置域名转发实例

域名:cps.45wan.com   所在阿里云主机:123.35.9.12 45wan没有在阿里云备案 67wan已经在阿里云备案 阿里云主机(假如123.35.9.12)上原来的nginx配置: server {listen 80; server_name cps.45wan.com; root /home/web/cps.45wan.com/htdocs/www; location / { root /home/web/cps.45wan.com/htdocs/www; } locatio

Apache 配置域名跳转

域名跳转需要在虚拟主机配置中添加别名和一个 rewrite 模块,如下,配置当访问 www.aaa.com 时跳转到 www.test.com [[email protected] ~]# vim /usr/local/apache2/conf/extra/httpd-vhosts.conf <VirtualHost *:80> DocumentRoot "/data/www" ServerName www.test.com ServerAlias www.aaa.com

LAMP_ 配置域名跳转

vi/usr/local/apache2/conf/extra/httpd-vhosts.conf 单域名跳转: <IfModule mod_rewrite.c>        RewriteEngine on        RewriteCond %{HTTP_HOST} ^www.domain1.com$        RewriteRule ^/(.*)$ http://www.domain2.com/$1 [R=301,L]    </IfModule> 如果是多个域名,可

LAMP(3)--apache配置域名跳转

★需求实现 之前搭建discuz时候使用的域名为www.caoyue111.com 现在我们要求实现访问域名www.hera111.com 时跳转到www.caoyue111.com ★配置步骤 我们只需在相应的虚拟主机中加入以下内容 vim /usr/local/apache2/conf/extra/httpd-vhosts.conf <IfModule mod_rewrite.c>   <== 打开rewrite.c模块(可用apachectl -M查看有无此模块)   Rewrit

Apache配置域名跳转

需求:要把访问域名 www.ppt.com(或www.ppt1.com) 的域名转发到 www.tpp.com 上实现: [[email protected] abc]# vim /usr/local/apache2/conf/extra/httpd-vhosts.conf <IfModule mod_rewrite.c>    RewriteEngine on    RewriteCond %{HTTP_HOST} ^www.ppt.com$    RewriteRule ^(.*)$ ht