国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

vps - nginx如何為一個(gè)網(wǎng)域下設(shè)定多個(gè)網(wǎng)站應(yīng)用程式?
為情所困
為情所困 2017-05-16 17:20:47
0
2
674

像這樣
www.example.com
blog.example.com
但是不同的應(yīng)用,例如www.example.com是靜態(tài)頁(yè)面,而blog.example.com是nodejs應(yīng)用程式
能做到嗎?具體怎麼配置呢?

為情所困
為情所困

全部回覆(2)
洪濤

靜態(tài)頁(yè)面設(shè)定root,應(yīng)用程式設(shè)定反向代理即可

server {
    listen      80;
    server_name blog.example.com ;    
    
    location  / {    
        proxy_pass http://127.0.0.1:8080;
        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_redirect off;
    }
}

server {
    listen      80;
    server_name www.example.com;
    
    location  / {
        root E:/Example/public;        
     }
}
PHPzhong

配置虛擬主機(jī)咯
貼一下偽代碼供參考吧

設(shè)定檔 nginx.conf 的 server段最後處加入

include vhost/*.conf;

建立vhost目錄
vhost目錄下建立檔案 例如 www.example.com.conf,blog.example.com.conf
然後做大致如下設(shè)定

server
{
    listen 80;
    server_name www.example.com;
    index index.php index.html index.htm ;
    root /var/www/www.example.com;
    
    if ( $fastcgi_script_name ~ \..*\/.*php ) {
        return 403;
    }
    
    location ~ \.php$ {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

當(dāng)然,nodejs不依賴(lài)ng,ng指定nodejs應(yīng)用程式資料夾,網(wǎng)域存取只觸發(fā)初始化,其他的通訊跟解釋交回給node服務(wù)

最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板