溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

CentOS 搭建WordPress個人網站

發布時間:2020-07-16 22:23:05 來源:網絡 閱讀:1309 作者:84368257 欄目:建站服務器

使用 Yum 安裝必要軟件
yum install nginx php php-fpm php-mysql mysql-server -y

將各軟件設置為開機啟動
chkconfig nginx on
chkconfig mysqld on
chkconfig php-fpm on

配置 Nginx
vim /etc/nginx/conf.d/default.conf

按字母“I”鍵或 “Insert” 鍵切換至編輯模式,將已有內容全部清除,復制并粘貼以下內容到 default.conf文件。
server {listen 80;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 500 502 503 504 /50x.html;location = /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;

啟動 Nginx
service nginx start

配置 MySQL
啟動 MySQL 服務器
service mysqld start

設置 MySQL 服務器 root 用戶的密碼,本教程設置為 “123456”,后續步驟中需要用到此用戶名和密碼
/usr/bin/mysqladmin -u root password “123456”

配置 PHP
啟動 PHP-FPM 服務
service php-fpm start

打開/etc/php.ini文件
vim /etc/php.ini
進入后直接輸入以下內容,回車定位到 “session.save_path” 的位置:
session.save_path = “/var/lib/php/session”

更改/var/lib/php/session目錄下所有文件的屬組都改成 nginx 和 nginx
chown -R nginx:nginx /var/lib/php/session

請使用以下命令在 Web 目錄下創建index.php文件
vim /usr/share/nginx/html/index.php

Test Page“;
echo “Hello World!”;
?>

先刪除網站根目錄下的index.html文件
rm /usr/share/nginx/html/index.html

依次下載 WordPress 并解壓到當前目錄
wget https://cn.wordpress.org/wordpress-4.9.4-zh_CN.tar.gz

tar zxvf wordpress-4.9.4-zh_CN.tar.gz

配置數據庫
使用 root 用戶登錄到 MySQL 服務器
mysql -uroot -p
為 WordPress 創建 MySQL 數據庫 “wordpress”
CREATE DATABASE wordpress;
為已創建好的 MySQL 數據庫創建一個新用戶 “user@localhost
CREATE USER user@localhost;
并為此用戶設置密碼“wordpresspassword”
SET PASSWORD FOR user@localhost=PASSWORD(“wordpresspassword”);
為創建的用戶開通數據庫 “wordpress” 的完全訪問權限。
GRANT ALL PRIVILEGES ON wordpress.* TO user@localhost IDENTIFIED BY ‘wordpresspassword’;
使用以下命令使所有配置生效
FLUSH PRIVILEGES;
配置完成,退出 MySQL
exit

寫入數據庫信息
創建新配置文件
cd wordpress/
cp wp-config-sample.php wp-config.php

打開并編輯新創建的配置文件
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’);

安裝 WordPress
mv * /usr/share/nginx/html/

在 Web 瀏覽器地址欄輸入 WordPress 站點的 IP 地址

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女