Apache按照教程配置证书后可以通过443端口访问,但是无法正确验证证书
所以在已有Apache的基础上安装Nginx
yum install nginx
安装完成后进入目录进行配置
cd /etc/nginx/conf.d
vi default.conf
修改内容如下
# The default server
#server {
# listen 80 default_server;
# listen [::]:80 default_server;
# server_name _;
# root /usr/share/nginx/html;
# # Load configuration files for the default server block.
# include /etc/nginx/default.d/*.conf;
# location / {
# }
# error_page 404 /404.html;
# location = /40x.html {
# }
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# }
server {
listen 443;
server_name xxx.xxx.cn;
ssl on;
ssl_certificate 1_xxx.xxx.cn_bundle.crt;
ssl_certificate_key 2_xxx.xxx.cn.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
location / {
root /yjdata/www/wordpress/api;
index index.html index.htm index.php;
}
location ~ .php$ {
root /yjdata/www/wordpress/api;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /yjdata/www/wordpress/api$fastcgi_script_name;
include fastcgi_params;
}
}
安装php-fpm
yum install php-fpm
修改配置
vi /etc/php-fpm.d/www.conf
修改如下内容
; RPM: apache Choosed to be able to access some dir as httpd
user = nginx
; RPM: Keep a group allowed to write in log dir.
group = nginx
设置Nginx和php-fpm自启动
chkconfig php-fpm on
chkconfig nginxon
重启Nginx和php-fpm
service nginx restart
service php-fpm restart
配置完成