Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and configure the blog program Typecho on the Nginx server

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to install and configure the blog program Typecho on the Nginx server, the content is detailed and easy to understand, the operation is simple and fast, and it has a certain reference value. I believe you will have something to gain after reading this article on how to install and configure the blog program Typecho on the Nginx server. Let's take a look.

1. download

# website directory 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

So the source code of typecho is put into / usr/local/nginx/html/build

two。 Configure the virtual machine of nginx (modify www.cxy.cc to your domain name), and configure typecho pseudo-static for nginx

Upstream php {server 127.0.0.1 server 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 | swf) ${expires 30d;} location ~. *. (js | css)? ${expires 12h;}}

3. Log in to phpmyadmin and create a new database. Be sure to set up the database in advance. If you install typecho directly, it will prompt "Sorry, cannot connect to the database. Please check the database configuration before continuing with the installation."

4. Access the http://www.cxy.cc/install.php prompt data database information to complete the installation.

5. The solution of some common problems

(1) after installing typecho, only the home page can be accessed, visit other pages and report 404 error.

The problem is that typecho requires pathinfo functionality, and nginx needs to be configured to support this feature. See step 2 for the solution.

In general, when this happens, the location setting in nginx.conf is similar to this.

Location ~. *\ .php$

To support pathinfo, change it to

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

In some older versions of php, you may also want to open cgi.fix_pathinfo in php.ini

Cgi.fix_pathinfo = 1

(2) the nginx server cannot be pseudo-static and cannot be configured successfully in the background.

This is mainly due to the fact that the rewrite of nginx is not set.

Find the server configuration section of the website in nginx.conf. Generally, we recommend the following configuration

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.1 } access_log logs/yourdomain.log combined;}

:!: be sure to replace the yourdomain in the above configuration with your own actual domain name and actual directory storage address

This is the end of the article on "how to install and configure the blog program Typecho on the Nginx server". Thank you for reading! I believe that everyone has a certain understanding of "how to install and configure the blog program Typecho on the Nginx server". If you want to learn more, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report