编译安装LNMP,并安装wordpress
- 安装mariadb和php-fpm
yum install mariadb-server php-fpm php-mysql -y
配置mariadb
systemctl start mariadb mysql_secure_installation mysql -p123 -e "CREATE DATABASE wpdb;GRANT ALL ON wpdb.* TO 'wpdb'@'%' IDENTIFIED BY '123';"
下载并编译nginx源码1.16版
# 安装编译环境 yum install gcc pcre-devel openssl-devel zlib-devel -y # 解包 tar -zxvf nginx-1.16.1.tar.gz # 增加nginx用户 useradd -r -s /sbin/nologin nginx # 开始编译 ./configure --prefix=/opt/nginx \ --user=nginx \ --group=nginx \ --with-http_ssl_module \ --with-http_v2_module \ --with-http_dav_module \ --with-http_stub_status_module \ --with-threads \ --with-file-aio \ --with-http_realip_module \ --with-http_gzip_static_module \ --with-pcre \ --with-stream \ --with-stream_ssl_module \ --with-stream_realip_module\ --conf-path=/etc/nginx/nginx.conf \ --error-log-path=/var/log/nginx/error.log \ --http-log-path=/var/log/nginx/access.log \ --pid-path=/var/run/nginx.pid \ --lock-path=/var/run/nginx.lock make && make install
配置php-fpm
更改/etc/php-fpm.d/www.confuser = nginx group = nginx
systemctl start php-fpm
安装wordpress
tar -zxvf wordpress-4.9.13.tar.gz -C /
复制/wordpress/wp-config-sample.php到/wordpress/wp-config.php并更改内容/** The name of the database for WordPress */ define('DB_NAME', 'wpdb'); /** MySQL database username */ define('DB_USER', 'wpdb'); /** MySQL database password */ define('DB_PASSWORD', '123'); /** MySQL hostname */ define('DB_HOST', 'localhost');
setfacl -R -m u:nginx:rwx /wordpress
配置nginx
ln -s /opt/nginx/sbin/nginx /usr/sbin/
vim /etc/nginx/nginx.conf
在server中listen 80; server_name www.chaoyi.com; location ~* \.php$ { root /wordpress; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
配置虚拟主机,www.chao.com域名实现首页访问,admin.chao.com域名实现wordpress的后台访问
在上一个配置基础上于http{}中加入
server {
listen 80;
server_name admin.chaoyi.com;
index wp-login.php;
location ~* \.php$ {
root /wordpress;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
原文地址:https://www.cnblogs.com/chaoyiyang/p/12491593.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。