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

這篇文章主要介紹了在Nginx服務(wù)器上怎么安裝配置博客程序Typecho的相關(guān)知識(shí),內(nèi)容詳細(xì)易懂,操作簡(jiǎn)單快捷,具有一定借鑒價(jià)值,相信大家閱讀完這篇在Nginx服務(wù)器上怎么安裝配置博客程序Typecho文章都會(huì)有所收獲,下面我們一起來(lái)看看吧。

創(chuàng)新互聯(lián)建站專注于網(wǎng)站建設(shè),為客戶提供成都網(wǎng)站建設(shè)、網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)開發(fā)服務(wù),多年建網(wǎng)站服務(wù)經(jīng)驗(yàn),各類網(wǎng)站都可以開發(fā),品牌網(wǎng)站建設(shè),公司官網(wǎng),公司展示網(wǎng)站,網(wǎng)站設(shè)計(jì),建網(wǎng)站費(fèi)用,建網(wǎng)站多少錢,價(jià)格優(yōu)惠,收費(fèi)合理。

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.gz
tart -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ù)庫(kù),一定要提前建立數(shù)據(jù)庫(kù),如果直接安裝typecho會(huì)提示“對(duì)不起,無(wú)法連接數(shù)據(jù)庫(kù),請(qǐng)先檢查數(shù)據(jù)庫(kù)配置再繼續(xù)進(jìn)行安裝”

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

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

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

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

location ~ .*\.php$

要支持pathinfo,要改成

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

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

cgi.fix_pathinfo = 1

(2)nginx服務(wù)器無(wú)法實(shí)現(xiàn)偽靜態(tài)化,在后臺(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;
  }

:!:注意把以上配置中的yourdomain換成你自己的實(shí)際域名和實(shí)際目錄存放地址

關(guān)于“在Nginx服務(wù)器上怎么安裝配置博客程序Typecho”這篇文章的內(nèi)容就介紹到這里,感謝各位的閱讀!相信大家對(duì)“在Nginx服務(wù)器上怎么安裝配置博客程序Typecho”知識(shí)都有一定的了解,大家如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。

分享標(biāo)題:在Nginx服務(wù)器上怎么安裝配置博客程序Typecho
轉(zhuǎn)載源于:http://muchs.cn/article16/iehcdg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供、企業(yè)網(wǎng)站制作、定制網(wǎng)站自適應(yīng)網(wǎng)站、外貿(mào)建站、營(yíng)銷型網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站網(wǎng)頁(yè)設(shè)計(jì)