EADST

Redirecting to a URL Using Nginx Configuration

Nginx is a powerful web server and reverse proxy server. Among its myriad features is the ability to effortlessly set up redirects for domains. In this post, we'll delve into a specific Nginx configuration that establishes a redirect for the domain xiedong.me and its www subdomain.

  1. apt-get install nginx # install

  2. /etc/init.d/nginx start # check nginx

  3. vim /etc/nginx/conf.d/config_name.conf

    server {
        listen 80;
        server_name xiedong.me www.xiedong.me;
        charset  utf-8;
        location / {
            rewrite ^/(.*)$ http://eadst.com/$1 permanent; # redirect to eadst.com
        }
    }

  4. /etc/init.d/nginx restart

相关标签
About Me
XD
Goals determine what you are going to be.
Category
标签云
站点统计

本站现有博文242篇,共被浏览292556

本站已经建立1784天!

热门文章
文章归档
回到顶部