centos7 yum 安装nginx 配置php 配置https

yum install nginx 直接安装nginx
安装php看http://www.cnblogs.com/JANCHAN/p/7724544.html

yum remove httpd 安装php7会自动安装上apache

nginx 配置 php
确保安装了php-fpm 没有安装yum install php-fpm
vi 打开 /etc/nginx/nginx.conf 修改location
location ~* \.php$ {
    fastcgi_index   index.php;
    fastcgi_pass    127.0.0.1:9000;
    include         fastcgi_params;
    fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
}

打开php-fpm yum 安装的php-fpm 在 /usr/sbin/ 下面
cd /usr/sbin 执行php-fpm(选中目录直接输入php-fpm)
nginx 配置php 就ok了

配置https

server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name xxx.com;
root /var/www;

ssl_certificate "cert/xxxx.pem";
ssl_certificate_key "cert/xxxx.key";
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;

# # Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;

location ~* \.php$ {
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}

error_page 404 /404.html;
location = /40x.html {
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}

  

猜你喜欢

转载自www.cnblogs.com/JANCHAN/p/9024422.html