**WordPress是一款常用的搭建个人博客网站软件,该软件使用PHP语言开发。
- 搭建nginx
默认情况下centos7.6没有nginx的源,需要配置Nginx官网提供Gentos的源地址。
- 配置nginx源
[root@hl-web lnmp-wordpress]# rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm [root@hl-web ~]# yum search nginx
- 安装nginx
[root@hl-web ~]# yum install -y pcre-devel openssl-devel #安装nginx依赖包 [root@hl-web ~]# yum install -y nginx
-
实现PHP联动
- 配置nginx的/etc/nginx/conf.d/default.conf文件,
server { listen 80; server_name 192.168.0.116; #access_log /var/log/nginx/host.access.log main; location / { root /usr/share/nginx/html/wordpress; index index.html index.htm index.php; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ .php$ { root /usr/share/nginx/html/wordpress; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param script_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } - 或者有的是配置nginx的/etc/nginx/nginx.conf文件
http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 4096; include /etc/nginx/mime.types; default_type application/octet-stream; # Load modular configuration files from the /etc/nginx/conf.d directory. # See http://nginx.org/en/docs/ngx_core_module.html#include # for more information. # Load modular configuration files from the /etc/nginx/conf.d directory. # See http://nginx.org/en/docs/ngx_core_module.html#include # for more information. include /etc/nginx/conf.d define('DB_NAME', 'wordpress'); define('DB_USER', 'root'); define('DB_PASSWORD', 'password'); define('DB_HOST', 'localhost'); define('DB_CHARSET', 'utf8'); define('DB_COLLATE', ''); - 验证wordpress,浏览器输入http://192.168.0.116
- 配置nginx的/etc/nginx/conf.d/default.conf文件,



