日日操夜夜添-日日操影院-日日草夜夜操-日日干干-精品一区二区三区波多野结衣-精品一区二区三区高清免费不卡

公告:魔扣目錄網(wǎng)為廣大站長(zhǎng)提供免費(fèi)收錄網(wǎng)站服務(wù),提交前請(qǐng)做好本站友鏈:【 網(wǎng)站目錄:http://www.ylptlb.cn 】, 免友鏈快審服務(wù)(50元/站),

點(diǎn)擊這里在線咨詢客服
新站提交
  • 網(wǎng)站:51998
  • 待審:31
  • 小程序:12
  • 文章:1030137
  • 會(huì)員:747

同一個(gè)端口是不能同時(shí)有兩個(gè)程序監(jiān)聽的。所以換個(gè)思路解決同一臺(tái)服務(wù)器下某些網(wǎng)站運(yùn)行在nginx下,某些網(wǎng)站運(yùn)行在apache下共存。

解決思路:

將nginx作為代理服務(wù)器和web服務(wù)器使用,nginx監(jiān)聽80端口,apache監(jiān)聽除80以外的端口,我這暫時(shí)使用8080端口。

Linux服務(wù)器下Nginx與Apache共存如何實(shí)現(xiàn)

解決方案:

  • 在linux 一經(jīng)搭建好環(huán)境 先后安裝了nginx 和apache 由于 默認(rèn)端口都是:80

  • 一般客戶請(qǐng)求的服務(wù)器端口默認(rèn)為80 所以nginx作為靜態(tài)頁(yè)端口設(shè)置:80;apache設(shè)置端口為:8080(在httpd.conf 文件中修改listen:8080)

apache下的網(wǎng)站:

在nginx.conf中 添加

server {
   listen  80;
   server_name www.one.ityangs.cn one.ityangs.cn;
location / {
   proxy_pass    http://127.0.0.1:8080;
   proxy_redirect   off;
   proxy_set_header host $host;
   proxy_set_header x-real-ip $remote_addr;
   proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
   }
}

在httpd.conf中 添加

<virtualhost *:8080>
servername www.one.ityangs.cn
serveralias www.one.ityangs.cn one.ityangs.cn
documentroot /www/one
directoryindex index.php index.html
<directory /www/one>
options +includes +followsymlinks -indexes
allowoverride all
order deny,allow
allow from all
</directory>
</virtualhost>

nginx下的網(wǎng)站:

在nginx.conf中 添加

 server {
  listen  80;
  server_name two.ityangs.cn www.two.ityangs.cn;
  root /www/two;
  location /{
   index index.html index.htm index.php;
    if (!-e $request_filename) {
    rewrite ^(.*)$ /index.php?s=$1 last;
    break;
   }
   error_page 404 /var/www/html/404.html;
  }
  location ~ \.php(.*)$ {
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_split_path_info ^((?u).+\.php)(/?.+)$;
    fastcgi_param script_filename $document_root$fastcgi_script_name;
    fastcgi_param path_info $fastcgi_path_info;
    fastcgi_param path_translated $document_root$fastcgi_path_info;
    include  fastcgi_params;
  }
}

以上就是Linux服務(wù)器下Nginx與Apache共存如何實(shí)現(xiàn)的詳細(xì)內(nèi)容。

分享到:
標(biāo)簽:apache Linux 共存 如何實(shí)現(xiàn) 服務(wù)器
用戶無(wú)頭像

網(wǎng)友整理

注冊(cè)時(shí)間:

網(wǎng)站:5 個(gè)   小程序:0 個(gè)  文章:12 篇

  • 51998

    網(wǎng)站

  • 12

    小程序

  • 1030137

    文章

  • 747

    會(huì)員

趕快注冊(cè)賬號(hào),推廣您的網(wǎng)站吧!
最新入駐小程序

數(shù)獨(dú)大挑戰(zhàn)2018-06-03

數(shù)獨(dú)一種數(shù)學(xué)游戲,玩家需要根據(jù)9

答題星2018-06-03

您可以通過(guò)答題星輕松地創(chuàng)建試卷

全階人生考試2018-06-03

各種考試題,題庫(kù),初中,高中,大學(xué)四六

運(yùn)動(dòng)步數(shù)有氧達(dá)人2018-06-03

記錄運(yùn)動(dòng)步數(shù),積累氧氣值。還可偷

每日養(yǎng)生app2018-06-03

每日養(yǎng)生,天天健康

體育訓(xùn)練成績(jī)?cè)u(píng)定2018-06-03

通用課目體育訓(xùn)練成績(jī)?cè)u(píng)定