首頁 > 後端開發 > php教程 > nginx設定vhost例子

nginx設定vhost例子

WBOY
發布: 2016-07-29 08:58:52
原創
977 人瀏覽過

nginx下面幾個設定vhost的範例
php

<code>server {
server_name stage.localhost;
<span>listen</span><span>80</span> ;
        root /data;
        <span>index</span><span>index</span>.html <span>index</span>.htm <span>index</span>.php;
location ~ .php$ {
        fastcgi_pass <span>127.0</span>.<span>0</span>.<span>1</span>:<span>9000</span>;
        fastcgi_index <span>index</span>.php;
        fastcgi_param SCRIPT_FILENAME  /data<span>$fastcgi_script_name</span>;
        include fastcgi_params;
    }
}</code>
登入後複製

靜態檔案

<code>server {
server_name sms<span>.fake</span><span>;</span>
listen <span>80</span><span>;</span>
        root /data/fakesms<span>;</span>
        index mobile1<span>.html</span> mobile1b<span>.html</span><span>;</span>
}</code>
登入後複製

其他語言開發的server服務

<code>server {
    listen   <span>80</span>;
    server_name localhost<span>.</span>pythonserver;

    access_log /<span>var</span>/<span>log</span>/nginx/pythonserver<span>-access</span><span>.</span><span>log</span> ;
    error_log /<span>var</span>/<span>log</span>/nginx/pythonserver<span>-error</span><span>.</span><span>log</span> ;
    charset utf<span>-</span><span>8</span>;
    client_max_body_size    <span>100</span>m;
    client_body_timeout     <span>60</span>;      
    location /exam0<span>/</span> {
        proxy_pass http:<span>//127.0.0.1:8889;</span>
    }
    location /exam1<span>/</span> {
        proxy_pass http:<span>//127.0.0.1:8880;</span>
    }
    location /exam2<span>/</span> {
        proxy_pass http:<span>//127.0.0.1:8881;</span>
    }
}</code>
登入後複製
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

以上就介紹了nginx設定vhost例子,包含了方面的內容,希望對PHP教學有興趣的朋友有幫助。

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板