nginx - related issues about domain name jump
某草草
某草草 2017-05-16 17:11:08
0
4
479

Question 1: If I have a domain name abc.com, now I want to automatically jump to about when I type abc.com in the browser. abc.com, just like the official website of gitlab.

What steps are needed to achieve this effect?
What knowledge is needed?

Question 2: If I now have a domain name abc.com, there are two folder directories under the html directory of nginx, one is bbs, one is wiki, how to set it up to access under the bbs directory when accessing bbs.abc.com index, what about opening index in the wiki directory when visiting wiki.abc.com?

What steps are needed to achieve this effect?
What knowledge is needed?

Note: I will learn Nginx, but I hope you can give me the knowledge I need first, or give me some tips and tell me what knowledge and steps are needed to achieve it. Thank you.

某草草
某草草

reply all(4)
習慣沉默

Question 1

Too many methods

  • The easiest thing is to set it during DNS resolution301跳转或者302跳转,将abc.com跳转到about.abc.com

  • can also be set in nginx

server {
        listen 80;
        server_name abc.com;

        return 301 https://about.abc.com$request_uri;
}
  • can also be set in the code, such as in js中指定window.locatioin, the back-end language response returns 301 and location, etc.

Question 2

server {
        listen 80;
        server_name bbs.abc.com;
        root path/to/bbs
        index index.php index.html
        
        #其他配置...
}
server {
        listen 80;
        server_name wiki.abc.com;
        root path/to/wiki
        index index.php index.html
        
        #其他配置...
}

In fact, you don’t need much knowledge or steps. You can achieve the effect you want by just searching online. If you want to go deeper, please google for question 1url redirect 301 302 nginx 显式跳转 隐式跳转等关键词
问题2请googlenginx 配置文件

为情所困

Use keywords:
nginx domain name redirection

大家讲道理

For question 1: Most resolution service providers have the "explicit URL forwarding" function. You can put abc.com解析到about.abc.com.

左手右手慢动作

Just a little google and you will get the answer immediately http://guge.suanfazu.com/sear...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!