current position:Home>How to install and configure the blogging program Typecho on the nginx server

How to install and configure the blogging program Typecho on the nginx server

2022-04-29 19:26:35Billion cloud speed

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

This article is mainly about Nginx The server How to install and configure blog program on Typecho Knowledge about , The content is detailed and easy to understand , The operation is simple and fast , It has certain reference value , I believe that after reading this article, you will be in Nginx How to install and configure the blog program on the server Typecho Articles will be fruitful , Let's have 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

such typecho Put your source code in /usr/local/nginx/html/build

2. To configure nginx Virtual machine ( modify www.cxy.cc For your domain name ),nginx To configure typecho Pseudostatic

 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. land phpmyadmin, New database , Be sure to establish the database in advance , If you install directly typecho Will prompt “ I'm sorry , Unable to connect to database , Please check the database configuration before continuing the installation ”

4. visit http://www.cxy.cc/install.php Follow the prompts for data database information , To complete the installation .

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

5. Solutions to some common problems
(1) installed typecho Only the home page can be accessed , Visit other pages 404 error .
The problem lies in typecho need pathinfo function ,nginx Configuration is required to support this feature , See Step 2 for the solution .

In general, when this happens ,nginx.conf Inside location The settings are similar to this

location ~ .*\.php$

To support pathinfo, To be converted into

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

In some older versions php Inside , You may have to open php.ini Inside cgi.fix_pathinfo

cgi.fix_pathinfo = 1

(2)nginx The server cannot be pseudo static , Failed to set in the background

This is mainly nginx Of rewrite It's not set up

stay nginx.conf Found the website in server Configuration section , Generally, we recommend the following configurations

  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;  }

:!: Pay attention to... In the above configuration yourdomain Change to your own actual domain name and actual directory storage address

About “ stay Nginx How to install and configure the blog program on the server Typecho” That's all for this article , Thank you for reading ! I'm sure you're right “ stay Nginx How to install and configure the blog program on the server Typecho” Knowledge has a certain understanding , If you want to learn more , Welcome to the Yisu cloud industry information channel .

copyright notice
author[Billion cloud speed],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/119/202204291744571052.html

Random recommended