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

CentOS builds WordPress personal website

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Use Yum to install the necessary software

Yum install nginx php php-fpm php-mysql mysql-server-y

Set each software to boot.

Chkconfig nginx on

Chkconfig mysqld on

Chkconfig php-fpm on

Configure Nginx

Vim / etc/nginx/conf.d/default.conf

Press the letter "I" or "Insert" key to switch to edit mode, clear all the existing contents, copy and paste the following into the default.conf file.

Server {listen 80th root / usr/share/nginx/html;server_name localhost

# charset koi8-r;#access_log / var/log/nginx/log/host.access.log main

Location / {

Index index.php index.html index.htm

}

# error_page 404 / 404.html

# redirect server error pages to the static page / 50x.html#error_page 500502 503504 / 50x.htmllocationlocation = / 50x.html {

Root / usr/share/nginx/html

}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000#location ~ .php ${

Fastcgi_pass 127.0.0.1:9000

Fastcgi_index index.php

Fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name

Include fastcgi_params

}

} index index.php index.html index.htm

Root / usr/share/nginx/html

Fastcgi_pass 127.0.0.1:9000

Fastcgi_index index.php

Fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name

Include fastcgi_params

Start Nginx

Service nginx start

Configure MySQL

Start the MySQL server

Service mysqld start

Set the password of the MySQL server root user, which is set to "123456" in this tutorial. You will need to use this user name and password in the following steps.

/ usr/bin/mysqladmin-u root password "123456"

Configure PHP

Start the PHP-FPM service

Service php-fpm start

Open the / etc/php.ini file

Vim / etc/php.ini

Enter the following directly after entering, and press enter to locate the location of "session.save_path":

Session.save_path = "/ var/lib/php/session"

Change the subordinate groups of all files under the / var/lib/php/session directory to nginx and nginx

Chown-R nginx:nginx / var/lib/php/session

Use the following command to create an index.php file in the Web directory

Vim / usr/share/nginx/html/index.php

Test Page "

Echo "Hello World!"

? >

Delete the index.html file in the root directory of the website first

Rm / usr/share/nginx/html/index.html

Download WordPress in turn and extract it to the current directory

Wget https://cn.wordpress.org/wordpress-4.9.4-zh_CN.tar.gz

Tar zxvf wordpress-4.9.4-zh_CN.tar.gz

Configuration database

Log in to the MySQL server using the root user

Mysql-uroot-p

Create a MySQL database "wordpress" for WordPress

CREATE DATABASE wordpress

Create a new user "user@localhost" for the created MySQL database

CREATE USER user@localhost

And set the password "wordpresspassword" for this user

SET PASSWORD FOR user@localhost=PASSWORD ("wordpresspassword")

Give the created user full access to the database "wordpress".

GRANT ALL PRIVILEGES ON wordpress.* TO user@localhost IDENTIFIED BY 'wordpresspassword'

Use the following command to make all configurations effective

FLUSH PRIVILEGES

Configuration complete, exit MySQL

Exit

Write database information

Create a new profile

Cd wordpress/

Cp wp-config-sample.php wp-config.php

Open and edit the newly created configuration file

Vim wp-config.php

/ / MySQL settings-You can get this info from your web host / /

/ * The name of the database for WordPress /

Define ('DB_NAME',' wordpress')

/ * MySQL database username /

Define ('DB_USER',' user')

/ * MySQL database password /

Define ('DB_PASSWORD',' wordpresspassword')

/ * MySQL hostname /

Define ('DB_HOST',' localhost')

Install WordPress

Mv * / usr/share/nginx/html/

Enter the IP address of the WordPress site in the Web browser address bar

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

Servers

Wechat

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

12
Report