Nginx
反向代理-要經(jīng)歷用戶(hù)請(qǐng)求到Nginx再請(qǐng)求到服務(wù)端,兩次請(qǐng)求。
負(fù)載均衡-只是負(fù)責(zé)請(qǐng)求的轉(zhuǎn)發(fā)
QPS 每秒查詢(xún)數(shù)
TPS 每秒提交數(shù)
一個(gè)網(wǎng)頁(yè)html格式大小150kb*500的QPS/1024=每秒73兆
千兆網(wǎng)卡理論峰值128兆,達(dá)到IO瓶頸

重新搭建了LNMP的wordpress博客,琢磨就在服務(wù)器上再配一個(gè)typecho。
按照已經(jīng)配好的wordpress,重新設(shè)置端口,把服務(wù)布了上去。

大概上是想實(shí)現(xiàn)這個(gè)效果。
訪(fǎng)問(wèn)域名-動(dòng)畫(huà)展示-展示頁(yè)面-頁(yè)面上提供2個(gè)博客的nginx的跳轉(zhuǎn)。
要注意的有幾點(diǎn),開(kāi)始愚蠢的還琢磨可以不可以同一個(gè)IP地址配不同的訪(fǎng)問(wèn)路徑作為項(xiàng)目的區(qū)分。后來(lái)趴在地上想了想覺(jué)得不可能,因?yàn)轫?xiàng)目配置在一起了你不可能保證路徑是不相同的。所以必須用IP地址和端口號(hào)作為區(qū)分。
安裝typecho蠻簡(jiǎn)單的,下載,解壓到目錄,一會(huì)配置nginx要用到這個(gè)目錄。開(kāi)訪(fǎng)問(wèn)端口,在iptables里配好。然后就是nginx的配置了:
在nginx安裝目錄/etc/nginx新建vhosts文件夾,里面存放的是配置不同端口的項(xiàng)目配置,以servername.conf來(lái)命名。

wordpress配置
server {
listen 8002 default;
server_name wordpress;
location / {
root 你的wordpress安裝地址;
index index.php index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
root 你的wordpress安裝地址;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /.ht {
deny all;
}
}
typecho配置
server {
listen 8001 default;
root 剛才說(shuō)安裝typecho的地址;
index index.html index.htm index.php;
server_name typecho;
location / {
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}
location ~ .*\.php(\/.*)*$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
}
再配置/etc/nginx下的nginx.conf

但是有一點(diǎn)要說(shuō)明的是,如果你之前安裝了LNMP的wordpress,那么這個(gè)wordpress大概率要廢棄掉,因?yàn)榘惭b成功后,wordpress指向的端口為原來(lái)的80端口,即便你nginx設(shè)置了8002,他仍舊會(huì)無(wú)法訪(fǎng)問(wèn),會(huì)報(bào)403錯(cuò)誤?;蛟Swordpress有這種更改設(shè)置,但是我懶了,直接刪除之前的數(shù)據(jù),重新安裝,指定文件夾(即配置wordpress.conf的root目錄)。
其他就是安裝了。