安裝 Nginx執(zhí)行以下命令,在 /etc/yum.repos.d/ 下創(chuàng)建 nginx.repo 文件。

vi" />

国产成人精品无码青草_亚洲国产美女精品久久久久∴_欧美人与鲁交大毛片免费_国产果冻豆传媒麻婆精东

15158846557 在線咨詢 在線咨詢
15158846557 在線咨詢
所在位置: 首頁 > 營銷資訊 > 網(wǎng)站運營 > 騰訊云服務(wù)wordpress建站

騰訊云服務(wù)wordpress建站

時間:2023-08-12 10:42:02 | 來源:網(wǎng)站運營

時間:2023-08-12 10:42:02 來源:網(wǎng)站運營

騰訊云服務(wù)wordpress建站:

安裝服務(wù)器環(huán)境

先打開騰訊云服務(wù)器實例頁面,然后點擊實例操作下面的"登錄"鏈接。輸入密碼進入Linux,如下:

安裝 Nginx

執(zhí)行以下命令,在 /etc/yum.repos.d/ 下創(chuàng)建 nginx.repo 文件。

vi /etc/yum.repos.d/nginx.repo按 i 切換至編輯模式,寫入以下內(nèi)容。

[nginx] name = nginx repo baseurl = https://nginx.org/packages/mainline/centos/7/$basearch/ gpgcheck = 0 enabled = 1按 Esc,輸入 :wq,保存文件并返回。

執(zhí)行以下命令,安裝 nginx。

yum install -y nginx執(zhí)行以下命令,打開 default.conf 文件。

vim /etc/nginx/conf.d/default.conf一直按d,刪除文件中的所有內(nèi)容,再按i 切換至編輯模式,編輯 default.conf 文件,將下面內(nèi)容copy進去。

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; }}按 Esc,輸入 :wq,保存文件并返回。

執(zhí)行以下命令啟動 Nginx。

systemctl start nginx執(zhí)行以下命令,設(shè)置 Nginx 為開機自啟動。

systemctl enable nginx

安裝PHP環(huán)境

依次執(zhí)行以下命令,更新 yum 中 PHP 的軟件源并安裝 PHP 7.2 所需要的包。

rpm -Uvh https://mirrors.cloud.tencent.com/epel/epel-release-latest-7.noarch.rpmrpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpmyum -y install mod_php72w.x86_64 php72w-cli.x86_64 php72w-common.x86_64 php72w-mysqlnd php72w-fpm.x86_64執(zhí)行以下命令,啟動 PHP-FPM 服務(wù)。

systemctl start php-fpm執(zhí)行以下命令,設(shè)置 PHP-FPM 服務(wù)為開機自啟動。

systemctl enable php-fpm查看PHP是否安裝好了

輸入php -v會展示如下版本內(nèi)容[root@VM-0-14-centos ~]# php -vPHP 7.2.34 (cli) (built: Oct 1 2020 13:37:37) ( NTS )Copyright (c) 1997-2018 The PHP GroupZend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

安裝MySQL

下載安裝MySQL

cd /usr/lcoalwget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz tar -xvf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz mv -v mysql-5.7.22-linux-glibc2.12-x86_64 /usr/lcoal/mysqlmkdir data增加MySQL用戶

groupadd mysqluseradd -r -g mysql mysqlchown -R mysql.mysql /usr/local/mysql初始化MySQL

yum -y install numactlyum search libaioyum install libaio/usr/local/mysql/bin/mysqld --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data --initialize編輯配置文件 /etc/my.cnf

vim /etc/my.cnf將文件替換成下面內(nèi)容

[mysqld]datadir=/usr/local/mysql/databasedir=/usr/local/mysqlsocket=/tmp/mysql.sockuser=mysqlport=3306character-set-server=utf8# 取消密碼驗證skip-grant-tables# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0# skip-grant-tables[mysqld_safe]log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pidMySQL加入到服務(wù)并開機啟動、最后啟動

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqlchkconfig mysql onservice mysql start增加MySQL配置

vim /etc/profile最后一行增加

export PATH=$PATH:/usr/local/mysql/bin再次執(zhí)行

source /etc/profile執(zhí)行下面命令、輸入下面命令直接回車

mysql -u root -pMySQL數(shù)據(jù)庫設(shè)置密碼

最好提前先建個數(shù)據(jù)庫(wordpress)CREATE DATABASE IF NOT EXISTS wordpress DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;Root密碼設(shè)置update user set authentication_string=password('你的密碼') where user='root';用戶名 uwordpress 密碼 abcd2021X123456 按自己需求修改CREATE USER 'uwordpress'@'localhost' IDENTIFIED BY 'abcd2021X123456';GRANT ALL PRIVILEGES ON wordpress.* TO 'uwordpress'@'localhost' IDENTIFIED BY 'abcd2021X123456';flush privileges;如果你想遠(yuǎn)程連接

update user set host='%' where user = 'root';flush privileges;退出MySQL

exit目前為止所需環(huán)境已經(jīng)安裝好了。

安裝WordPress

如果你沒有安裝上面的建數(shù)據(jù)庫,現(xiàn)在你需要創(chuàng)建數(shù)據(jù)庫

最好提前先建個數(shù)據(jù)庫(wordpress)CREATE DATABASE IF NOT EXISTS wordpress DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;用戶名 uwordpress 密碼 abcd2021X123456 按自己需求修改GRANT ALL PRIVILEGES ON wordpress.* TO 'uwordpress'@'localhost' IDENTIFIED BY 'abcd2021X123456';flush privileges;進入操作目錄

cd /usr/share/nginx/html下載WordPress

wget https://cn.wordpress.org/latest-zh_CN.tar.gztar zxvf latest-zh_CN.tar.gzcd /usr/share/nginx/html/wordpresscp wp-config-sample.php wp-config.phpvim wp-config.php編輯 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', 'uwordpress'); /** MySQL database password */ define('DB_PASSWORD', 'abcd2021X123456'); /** MySQL hostname */ define('DB_HOST', 'localhost');修改完成后,按 Esc,輸入 :wq,保存文件返回。

執(zhí)行以下命令,重啟 Nginx 服務(wù)。systemctl restart nginx啟動wordpress

在瀏覽器地址欄輸入 http://192.xxx.xxx.xx/wordpress 192.xxx.xxx.xx是你的外網(wǎng)域名,如下圖中:如果顯示數(shù)據(jù)庫連接錯誤,你需要將上面 wp-config.php 中 define('DB_HOST', 'localhost'); localhost 改成內(nèi)外IP地址,內(nèi)網(wǎng)IP在上圖外網(wǎng)的下面哈。如果顯示下圖說明你已經(jīng)成功了,開啟你的wordpress之旅了哈。



關(guān)鍵詞:服務(wù)

74
73
25
news

版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。

為了最佳展示效果,本站不支持IE9及以下版本的瀏覽器,建議您使用谷歌Chrome瀏覽器。 點擊下載Chrome瀏覽器
關(guān)閉