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使用
mysqlcreate database xxx- 创建该数据库的账户密码
grant all privileges on wpdb.* to '账户1'@'localhost' identified by '密码1';
账户名:账户1,密码:密码1- 看看已有的数据库
show databases;
- 开启所有服务
systemctl enable mariadb
systemctl start mariadbsystemctl enable php-fpm
systemctl start php-fpmsystemctl enable nginx
systemctl start nginx
- 下载
wordpress到/var/wordpress(站点根目录)
wget下载解压打包看别的blog- 修改
/var/wordpress的所属组和用户 chmod 755 -R /var/wordpresschown nginx:nginx -R wordpresswordpress的权限给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
本文详细介绍了如何在购买的国外服务器上搭建LNMP环境,并通过修改DNS解析设置完成域名实名验证。随后,逐步指导如何配置nginx、php-fpm及MariaDB,创建数据库并下载WordPress进行安装。此外,还提供了解决低配服务器性能问题的方法,如调整MySQL配置避免内存溢出,以及确保防火墙允许HTTP访问。

1209

被折叠的 条评论
为什么被折叠?



