wordpress搭建
- 域名现在要实名
- 买了国外服务器后(可以使用默认的dns服务器,一般都能解析),然后修改
dns 解析设置
,设置为服务器的ip 好像修改dns服务器要等几个小时才能成功dig yourdomain
或者nslookup youdomain
查看是否域名解析到ip
是否成功
lnmp环境搭建
- 安装
nginx mariadb php-fpm
… nginx
配置文件修改(写入内容是抄的):vim /etc/nginx/conf.d/web.conf
server_name
:自己的域名root
:表示nginx
站点根目录
#======================== WEB options ============================
server {
listen 80;
server_name yourdomain;
root /var/wordpress;
index index.php index.html;
charset utf-8;
#======================== Pseudo static ==========================
location / {
if (-f $request_filename/index.html){ rewrite (.*) $1/index.html break; }
if (-f $request_filename/index.php){ rewrite (.*) $1/index.php; }
if (!-f $request_filename){ rewrite (.*) /index.php; }
}
#======================== PHP options ============================
location ~ \.php {
root /var/wordpress;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
#======================== Error page =============================
error_page 400 403 404 /40x.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
- 配置
php
服务
vim /etc/php-fpm.d/www.conf
nginx
用户使用php-fpm
服务,权限设置
user = nginx
group = nginx
- 创建一个数据库给
wordpress
使用
mysql
create database xxx
- 创建该数据库的账户密码
grant all privileges on wpdb.* to '账户1'@'localhost' identified by '密码1';
账户名:账户1
,密码:密码1
- 看看已有的数据库
show databases;
- 开启所有服务
systemctl enable mariadb
systemctl start mariadb
systemctl enable php-fpm
systemctl start php-fpm
systemctl enable nginx
systemctl start nginx
- 下载
wordpress
到/var/wordpress
(站点根目录)
wget
下载解压打包看别的blog
- 修改
/var/wordpress
的所属组和用户 chmod 755 -R /var/wordpress
chown nginx:nginx -R wordpress
wordpress
的权限给nginx
避免一些权限报错
- 域名访问来安装
wordpress
关于低配便宜辣鸡服务器,mariadb(mysql)
服务自动终止原因
vim /var/log/mariadb/mariadb.log
查看报错
140521 08:26:40 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140521 08:26:41 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
mysqld: Out of memory (Needed 128917504 bytes)之类的报错
Fatal error: cannot allocate memory for the buffer pool
无法在内存中分配内存.服务器内存小.
原因:
Well, the issue here is Performance Schema, and not making it obvious.
When starting up, it allocates all the RAM it needs.
By default, it will use around 400MB of RAM,
which isn’t noticible with a database server with 64GB of RAM,
but it is quite significant for a small virtual machine.
默认是性能模式且不明显,sql启动时会分配它需要的RAM,默认会使用400MB,大服务器上这点不算什么.但是在小虚拟机上很重要
好像我的Plugins
(插件)服务也因为内存的原因不能用
修改配置文件vim /etc/my.cnf
,在[mysqld]
项下.
添加:performance_schema = off
当运行环境正常和域名解析正确时,如果还是访问不了,说明服务器的防火墙关闭了80端口
- 关闭防火墙
- 开启
80端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
systemctl restart firewalld