前天正式安裝了 Nginx , 系統 Freebsd .
全部軟件: FreeBSD+FTP+NGINX
全部用來跑 HTML 的純靜態頁面 ( 頁面由另一台PHP+MYSQL生成 )
目前運行了二天,一直在關查....
二個字 : 非常爽
有幾點要特別注意的,
在安裝 Nginx 時, 默認裡是沒有 SUB-DOMAIN 選擇的,要打上鉤 . 我就是因為沒有打上這個東西, 最後配置 nginx.conf 的 域名時,出了很多問題. 不支持泛域名... -_-
後來重新config 安裝了. 但是對 Nginx.conf 裡的 域名 配置還是有點問題. 不過,目前正常,不敢再亂搞:
-----------------------host and domain--------------------------------------
server {
listen 80;
server_name .domain1.com;
location / {
root /usr/home/web/domain1;
index index.html;
access_log off;
}
}
server {
listen 80;
server_name .domain2.com;
location / {
root /usr/home/web/domain2;
index index.html;
access_log off;
}
}
server {
listen 80;
server_name .domain3.com;
location / {
root /usr/home/web/domain3;
index index.html;
access_log off;
}
}
server {
listen 80;
server_name state.domain.com state.domain2.com;
location / {
stub_status on;
access_log off;
}
}
-----------------------host and domain--------------------------------------
其中 , server_name .domain3.com; 中的 .domain3.com 意思是 *.domain3.com , 查了很多資料,不知道為什麼,按自帶的說明裡配置不行,進入域名後會直接到默認首頁,就是剛安裝好APACHE一樣的歡迎頁面...
之前是這樣配置的,不行:
server {
listen 80;
server_name domain1.com alias my1.domain1.com my2.domain1.com;
location / {
root /usr/home/web/domain1;
index index.html;
access_log off;
}
}
不知道為什麼,以上配置. 輸入domain1.com alias my1.domain1.com都進入歡迎頁面 , 只有my2.domain1.com進入目錄...
看了官方教學, 這樣配置 server_name domain1.com my1.domain1.com my2.domain1.com; 也一樣 只有my2.domain1.com進入目錄...
不懂.