零基礎學習雲端運算及大資料DBA叢集架構師【企業級營運技術及實踐項目2015年1月27日周三】

來源:互聯網
上載者:User

標籤:

Nginx 基於 ip 的虛擬機器主機配置{#serverb(1)/etc/nginx/conf.d/*[[email protected] conf.d]# vim ip.confserver {        listen  192.168.1.88:80;        root    88.com;        index   index.html;  }server {        listen  192.168.1.87:80;        root    87.com;        index   index.html;  }[[email protected] ~]# ifconfig eth1:0 192.168.1.88[[email protected] ~]# ifconfig eth1:1 192.168.1.87[[email protected] ~]# mkdir /usr/local/nginx/88.com[[email protected] ~]# echo ‘this is 88.com‘ > /usr/local/nginx/88.com/index.html[[email protected] ~]# mkdir /usr/local/nginx/87.com[[email protected] ~]# echo ‘this is 87.com‘ > /usr/local/nginx/87.com/index.html }Nginx 基於連接埠的虛擬機器主機配置{server {    listen 80;    root 80.com;}server {    listen 8080;    root 8080.com;}[[email protected] ~]# mkdir /usr/local/nginx/80.com[[email protected] ~]# mkdir /usr/local/nginx/8080.com[[email protected] ~]# echo ‘this is 80.com‘ > /usr/local/nginx/80.com/index.html[[email protected] ~]# echo ‘this is 8080.com‘ > /usr/local/nginx/8080.com/index.html}基於名稱的虛擬機器主機配置詳解{1.www.dabao.comwww.booboo.com[[email protected] conf.d]# pwd/etc/nginx/conf.d[[email protected] conf.d]# cp default.conf www.booboo.com.conf[[email protected] conf.d]# cp default.conf www.dabao.com.conf[[email protected] conf.d]# vim www.booboo.com.confserver {    listen       80;    server_name  www.booboo.com;    location / {        root   /usr/share/nginx/booboo.com;        index  index.html index.htm;    }}[[email protected] conf.d]# vim www.dabao.com.confserver {       listen       80;        server_name  www.dabao.com;        root   /usr/share/nginx/dabao.com;        index  index.html index.htm;    }[[email protected] conf.d]# mkdir /usr/share/nginx/dabao.com[[email protected] conf.d]# mkdir /usr/share/nginx/booboo.com[[email protected] conf.d]# echo hi,booboo > /usr/share/nginx/booboo.com/index.html[[email protected] conf.d]# echo hi,dabao> /usr/share/nginx/dabao.com/index.html#重啟 nginx 服務[[email protected] conf.d]# systemctl restart nginx.serviceworkstation 用戶端測試[[email protected] ~]# echo 172.25.15.10 www.dabao.com >> /etc/hosts[[email protected] ~]# echo 172.25.15.10 www.booboo.com >> /etc/hosts2.server_namemail.dabao.comnews.dabao.comwww.news.dabao.comwww.sports.dabao.com[[email protected] conf.d]# vim www.booboo.com.confserver {    listen       80;    server_name  ~www\..*\.booboo\.com;    location / {        root   /usr/share/nginx/booboo.com;        index  index.html index.htm;    }}[[email protected] conf.d]# vim www.dabao.com.confserver {       listen       80;        server_name  *.dabao.com;        root   /usr/share/nginx/dabao.com;        index  index.html index.htm;    }3.locationwww.booboo.com/news.html[[email protected] conf.d]# cat www.booboo.com.confserver {    listen       80;    server_name  ~www.*\.booboo\.com;    location / {        root   /usr/share/nginx/booboo.com;        index  index.html index.htm;    }    location ~/news.html{        root    /usr/share/nginx/dabao.com;        index   index.html index.htm;        }}4.80 default[[email protected] conf.d]# cp default.conf err.com.conf[[email protected] conf.d]# vim err.com.confserver {listen 80 default;#在監聽連接埠號碼後邊添加 default 欄位,即代表該虛擬機器主機為預設虛擬機器主機location / {root /usr/share/nginx/err.com;index index.html index.htm;}#建立該虛擬機器主機網頁檔案存放目錄和首頁檔案,一般首頁檔案中即為報錯資訊[[email protected] conf.d]# mkdir /usr/share/nginx/err.com[[email protected] conf.d]# echo cannot found this virtual host name > /usr/share/nginx/err.com/index.html#重啟 nginx 服務[[email protected] conf.d]# systemctl restart nginx.service(4)workstation 用戶端測試}

 

零基礎學習雲端運算及大資料DBA叢集架構師【企業級營運技術及實踐項目2015年1月27日周三】

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.