Centos安装wordpress【nginx php https】

1.安装nginx

https://blog.csdn.net/weixin_42818402/article/details/100572863

2.安装php

https://blog.csdn.net/weixin_42818402/article/details/100572876

3.安装mysql

https://mp.csdn.net/postedit/100572899

4.下载wordpress

5.配置nginx

  • vim /etc/nginx/nginx.conf
server{
	...
	root         /root/wp;
	index index.php index.html
	...
		 # PHP配置
        location ~ \.php$ {
          fastcgi_pass 127.0.0.1:9000;
          fastcgi_index index.php;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          include fastcgi_params;
        }
	...
}

6. 配置wordpress

  • 启动nginx,mysql,php-fpm
  • 打开首页,输入提示的信息后得到wp-config配置文件
  • 创建wp-config.php并添加
# 这样配置不需要FTP
define("FS_METHOD", "direct");
define("FS_CHMOD_DIR", 0777);
define("FS_CHMOD_FILE", 0777);
  • 修改文件夹权限
chmod 777 -R wp-content
chmod 777 -R wp-admin
chmod 777 -R wp-includes

7.解决上传文件大小限制

  • vim /etc/php.ini
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 3600
  • vim /etc/nginx/nginx.conf
server{
…
client_max_body_size 64m;
}

8.配置HTTPS

  • 修改配置
server {
        listen       80;
        server_name 域名;
        # 强制跳转https
        rewrite ^(.*) https://$server_name$1 permanent;
    }

    server {
        listen       443 ssl;
        server_name  域名;
        root         /root/wp;
        index index.php index.html;
        ssl_certificate "/root/cert/域名.pem";
        ssl_certificate_key "/root/cert/域名.key";
        ssl_session_cache shared:SSL:1m;
        ssl_session_timeout  10m;
        ssl_ciphers HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers on;
		client_max_body_size 64m;
        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        # PHP配置
        location ~ \.php(.*)$ {
          fastcgi_pass 127.0.0.1:9000;
          fastcgi_index index.php;
          fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          fastcgi_param PATH_INFO $fastcgi_path_info;
          fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
          include fastcgi_params;
        }

    }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值