国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > 建站經驗 > 正文

詳解阿里云nginx服務器多站點的配置

2019-11-02 16:41:04
字體:
來源:轉載
供稿:網友

阿里云nginx服務器多站點的配置

今天配置了一下多站點,記錄一下配置的過程...

1、首先要找到nginx 配置文件之所在,阿里云上的nginx.conf 文件上 /alidata/server/nginx-1.4.4/conf 中。

2、然后在conf目錄下創建一個vhosts 目錄,  這個目錄是用來存放不同站點的配置文件的。

3、然后呢, 在nginx.conf 最后 加入一行 include /alidata/server/nginx/conf/vhosts/*.conf;

user www www; worker_processes 1;  error_log /alidata/log/nginx/error.log crit; pid    /alidata/server/nginx/logs/nginx.pid;  #Specifies the value for maximum file descriptors that can be opened by this process.  worker_rlimit_nofile 65535;  events  {  use epoll;  worker_connections 65535; }   http {   include    mime.types;   default_type application/octet-stream;    #charset gb2312;    server_names_hash_bucket_size 128;   client_header_buffer_size 32k;   large_client_header_buffers 4 32k;   client_max_body_size 8m;    sendfile on;   tcp_nopush   on;    keepalive_timeout 60;    tcp_nodelay on;    fastcgi_connect_timeout 300;   fastcgi_send_timeout 300;   fastcgi_read_timeout 300;   fastcgi_buffer_size 64k;   fastcgi_buffers 4 64k;   fastcgi_busy_buffers_size 128k;   fastcgi_temp_file_write_size 128k;    gzip on;   gzip_min_length 1k;   gzip_buffers   4 16k;   gzip_http_version 1.0;   gzip_comp_level 2;   gzip_types    text/plain application/x-javascript text/css application/xml;   gzip_vary on;   #limit_zone crawler $binary_remote_addr 10m;   log_format '$remote_addr - $remote_user [$time_local] "$request" '          '$status $body_bytes_sent "$http_referer" '          '"$http_user_agent" "$http_x_forwarded_for"';             # 加入下面一行 表示將 vhosts 下面所有的 conf 文件包含進來   include /alidata/server/nginx/conf/vhosts/*.conf; } 

4、然后,就是在vhosts 目錄下寫 你對應站點的 conf 文件了。下面給出一個范例

server {   listen    80;   # 這個表示 網站域名, 可以是二級甚至多級域名   server_name localhost demo.com www.demo.com test.demo.com;    # 表示默認索引文件   index index.html index.htm index.php;      # 該站點對應的網站根目錄所在   root /alidata/www/demo;    location ~ .*/.(php|php5)?$   {     #fastcgi_pass unix:/tmp/php-cgi.sock;     fastcgi_pass 127.0.0.1:9000;     fastcgi_index index.php;     include fastcgi.conf;   }   location ~ .*/.(gif|jpg|jpeg|png|bmp|swf)$   {     expires 30d;   }   location ~ .*/.(js|css)?$   {     expires 1h;   }    # 偽靜態規則   include /alidata/server/nginx/conf/rewrite/phpwind.conf;   access_log /alidata/log/nginx/access/phpwind.log; } 

5、如果還要繼續添加, 直接復制文件。然后修改一下 server_name, root, 和access_log(如果有必要的話) 就OK了。

6、然后,不要立馬重啟nginx,應該要先測試一下nginx 配置文件是否正常. 找到nginx 的 sbin目錄。 注意, 這個地方是nginx 的sbin 目錄(這個目錄與nginx 的conf 目錄是同級目錄)。linux 下有許多與sbin同名的目錄。 容易搞錯。 在阿里云服務器上一般默認的目錄是 /alidata/server/nginx-1.4.4/sbin。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 舒兰市| 都江堰市| 南乐县| 沅陵县| 德清县| 松桃| 抚远县| 乐陵市| 南昌县| 泰兴市| 桦甸市| 无锡市| 涞水县| 刚察县| 新龙县| 凤山县| 盘山县| 新津县| 余姚市| 布拖县| 奈曼旗| 永州市| 农安县| 浙江省| 龙岩市| 潼关县| 晋城| 霍山县| 贵阳市| 兴业县| 门源| 西丰县| 玛纳斯县| 肃北| 同仁县| 莱州市| 鸡西市| 斗六市| 若尔盖县| 顺平县| 铁岭县|