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

首頁 > 網(wǎng)站 > Nginx > 正文

在Nginx服務(wù)器上安裝配置博客程序Typecho的教程

2024-08-30 12:26:25
字體:
供稿:網(wǎng)友

typecho比wordpress更輕,更專注于寫的享受。

現(xiàn)在大多的虛擬機(jī)運(yùn)行環(huán)境都是lnmp,安裝教程安裝typecho可能會遇到404,數(shù)據(jù)配置錯誤問題。

把這兩天安裝typecho的步驟寫下來給大家參考.

typecho安裝方法

1.下載

#網(wǎng)站目錄cd /usr/local/nginx/html/wget https://github.com/typecho/typecho/releases/download/v0.9-13.12.12-release/0.9.13.12.12.-release.tar.gz -O typecho.tar.gztart -zxvf typecho.tar.gz

這樣typecho的源代碼放到了/usr/local/nginx/html/build

2.配置nginx的虛擬機(jī)(修改www.cxy.cc為你的域名),nginx配置typecho偽靜態(tài)

 upstream php { server 127.0.0.1:9000; } server { server_name www.cxy.cc; root html/build; access_log logs/wcxy.access.log main; error_log logs/wcxy.error.log; index index.php list.php; location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } if ( !-e $request_filename ) { rewrite ^(.*)$ /index.php$1 last; } location ~ .*.php(/.*)*$ { fastcgi_index index.php; include fastcgi.conf; fastcgi_split_path_info ^((?U).+.php)(/?.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; fastcgi_intercept_errors on; fastcgi_pass php; } location /status { #stub_status on; access_log off; } location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*.(js|css)?$ { expires 12h; } } 

3.登陸phpmyadmin,新建數(shù)據(jù)庫,一定要提前建立數(shù)據(jù)庫,如果直接安裝typecho會提示“對不起,無法連接數(shù)據(jù)庫,請先檢查數(shù)據(jù)庫配置再繼續(xù)進(jìn)行安裝”

4.訪問http://www.cxy.cc/install.php 按提示數(shù)據(jù)數(shù)據(jù)庫信息,即可完成安裝。

2015122995229365.jpg (258×543)

5.一些常見問題的解決
(1)安裝完typecho只有首頁能訪問,訪問其它頁頁面報404錯誤。
問題在于typecho需要pathinfo功能,nginx需要配置才能支持此功能,解決辦法見第二步。

一般的出現(xiàn)這種情況時,nginx.conf里的的location設(shè)置都是類似這樣

location ~ .*/.php$

要支持pathinfo,要改成

location ~ .*/.php(//.*)*$

在某些老版本的php里面,可能還要打開php.ini里的cgi.fix_pathinfo

cgi.fix_pathinfo = 1

(2)Nginx服務(wù)器無法實(shí)現(xiàn)偽靜態(tài)化,在后臺設(shè)置不成功

這主要是nginx的rewrite沒有設(shè)置導(dǎo)致的

在nginx.conf里找到網(wǎng)站的server配置段,一般我們推薦如下的配置

 

  server {    listen     80;    server_name   yourdomain.com;    root      /home/yourdomain/www/;    index      index.html index.htm index.php;     if (!-e $request_filename) {      rewrite ^(.*)$ /index.php$1 last;    }     location ~ .*/.php(//.*)*$ {      include fastcgi.conf;      fastcgi_pass 127.0.0.1:9000;    }     access_log logs/yourdomain.log combined;  }            
發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 东方市| 绍兴市| 高平市| 汤原县| 云阳县| 青海省| 西畴县| 雅安市| 山阴县| 滨海县| 新竹市| 枣阳市| 绥阳县| 灵丘县| 乐清市| 仙居县| 梧州市| 嘉义市| 凤城市| 江川县| 咸宁市| 旬邑县| 临泉县| 绥阳县| 宁城县| 黔西县| 富蕴县| 广丰县| 延寿县| 咸阳市| 揭阳市| 本溪市| 巴彦县| 西乌珠穆沁旗| 黄梅县| 泊头市| 叶城县| 新密市| 怀柔区| 崇明县| 鹿邑县|