第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

nginx反向代理apache動(dòng)靜分離,路由不正常跳轉(zhuǎn)

nginx反向代理apache動(dòng)靜分離,路由不正常跳轉(zhuǎn)

PHP
海綿寶寶撒 2019-03-18 18:07:28
運(yùn)行環(huán)境: centos7 php7.1 nginx 1.10 apache 2.4 php框架phalcon nginx.conf配置 upstream lamp{ server 127.0.0.1:81 weight=1 max_fails=3 fail_timeout=30s; } server { listen 80; server_name we.test.com; index index.php root /wwwroot/test/public; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ .*\.(php|jsp|cgi)?$ { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://lamp; } location ~ .*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css)$ { root /wwwroot/test/public; expires 3d; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } apache vhost配置 <VirtualHost *:81> ServerName we.test.com DocumentRoot /wwwroot/test/public <Directory wwwwroot/test/public> Options FollowSymLinks MultiViews AllowOverride all Order allow,deny Allow from all Require All granted </Directory> </VirtualHost> .htaccess 文件 (在public目錄下) AddDefaultCharset UTF-8 <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L] </IfModule> 當(dāng)我訪問(wèn) we.test.com:81的時(shí)候所有的路由可以正常訪問(wèn) 例如 we.test.com/user/login 或者 接受 參數(shù) we.test.com/article/index?id=5 但是當(dāng)我 訪問(wèn) nginx監(jiān)聽(tīng)的80端口 ,所有的訪問(wèn)都很奇怪,就是瀏覽器的url會(huì)變成對(duì)應(yīng)的路由 例如we.test.com/user/login 但是 頁(yè)面展示的內(nèi)容 還是 we.test.com的默認(rèn)頁(yè),只是刷新了一下。 剛剛嘗試這種 nginx 反向代理 apache ,不知道有沒(méi)有大神可以幫忙解答一下。非常非常感謝。 如有有缺少的條件,我會(huì)及時(shí)回復(fù) 在線等。。。
查看完整描述

1 回答

?
回首憶惘然

TA貢獻(xiàn)1847條經(jīng)驗(yàn) 獲得超11個(gè)贊

apache不需要更改,nginx配置改一下

location / {
                if (!-e $request_filename) {
                        rewrite ^/(.*)$ /index.php?$1 last;
                }
        }
        location ~ \.php$ {
         proxy_set_header Host  $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://lamp;
        }                               
查看完整回答
反對(duì) 回復(fù) 2019-03-18
  • 1 回答
  • 0 關(guān)注
  • 563 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)