Redirecting to a URL Using Nginx Configuration
作者:XD / 发表: 2023年9月14日 06:50 / 更新: 2023年9月14日 06:51 / 编程笔记 / 阅读量:737
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.
-
apt-get install nginx # install
-
/etc/init.d/nginx start # check nginx
-
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 } }
-
/etc/init.d/nginx restart
相关标签