Rewrite root address to a subdirectory in nginx

后端 未结 7 795
攒了一身酷
攒了一身酷 2020-12-29 19:55

I\'m converting my mediawiki site to use nginx as a frontend for static files with apache on the backend for php. I\'ve gotten everything working so far except for when I vi

7条回答
  •  北海茫月
    2020-12-29 20:27

    1. Make sure "/wiki/Main_Page" can be successfully accessed
    2. Check in the server section, there are no global rewrite rules. Rewrite rules in server section will be executed before location section.
    3. Using rewrite rules in location section like this:

      location = / {
           rewrite "^.*$" /wiki/Main_Page break;    
      }
      

    Pay attention "break" here. Means break out the rewrite cycle.

    If this page is located in backend server, here should use proxy_pass.

提交回复
热议问题