Install the Typecho tutorial on the Nginx server for the Configure blog program _nginx

Source: Internet
Author: User
Tags nginx server

Typecho is lighter than WordPress, and more focused on the enjoyment of writing.

Now most of the virtual machine running environment is LNMP, installation Tutorial installation Typecho may encounter 404, data configuration error problem.

The two days to install the Typecho steps to write down for your reference.

Typecho Installation Method

1. Download

#网站目录
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

So Typecho's source code is in the/usr/local/nginx/html/build.

2. Configure Nginx virtual machine (modify www.cxy.cc for your domain name), nginx configure Typecho pseudo static

 upstream PHP {server 127.0.0.1:9000;} server {server_name www.cxy.cc; root Html/bui ld 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; acce Ss_log off; } if (!-e $request _filename) {rewrite ^ (. *) $/index.php$1 last;} location ~ *.php (/.*) *$ {fastcgi_index index.php; i Nclude 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. Landing phpMyAdmin, create a new database, be sure to set up a database in advance, if the direct installation Typecho will prompt "Sorry, unable to connect to the database, please check the database configuration before continuing the installation"

4. Access Http://www.cxy.cc/install.php Press the prompt data database information, you can complete the installation.

5. Solutions to some common problems
(1) After installation Typecho only the home page can access, access to other pages of the page report 404 errors.
The problem is that Typecho requires pathinfo functionality and Nginx needs to be configured to support this functionality, see step two.

Generally when this happens, the location settings in nginx.conf are similar

Location ~. *\.php$

To support PathInfo, change it to

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

In some old versions of PHP, you might want to open the Cgi.fix_pathinfo in php.ini.

Cgi.fix_pathinfo = 1

(2) Nginx server can not achieve pseudo static, in the background settings are unsuccessful

This is mainly Nginx rewrite not set to cause the

In nginx.conf to find the site's server configuration segment, generally we recommend the following configuration

  server {
    listen     ;
    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;
  }

:!: Pay attention to replacing the yourdomain in the above configuration with your own actual domain name and the actual directory store address

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.