一、准备工作
- 拥有公网IP的服务器
- 安装好LNMP(Nginx+Mysql+PHP)
- 下载好Wordpress安装包
二、环境配置
1. Nginx的配置
server {
listen 80;
# 这里配置的本机地址,也可以是域名比如wankaicheg.xyz
server_name localhost;
location / {
#资源地址,也就是wordpress的解压路径,这里html是nginx的安装路径相对路径
root html;
#索引文件,打开网址会访问的文件
index index.html index.htm index.php;
}
## 这是对index.php文件的解析,不写这段index.php放在Nginx目录下不会生效
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
#不写下面这行nginx会报错 Primary script unknown
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
2. PHP的配置
删掉 listen = /tmp/php-cgi-74.sock ,新增listen = 127.0.0.1:9000
3. Mysql的配置
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'password';
GRANT ALL ON wordpress.* TO 'wordpress'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
EXIT;
宝塔面板要开启mysql的远程访问
Comments 1 条评论
good