一直没有配置过https ,最近手动配置下发现挺简单的,记录一下。
server {
listen 443;
server_name interface.e-chains.cn;
server_tokens off;
ssl on;
ssl_certificate /etc/ssl/e-chains.cn/bundle.cer;
ssl_certificate_key /etc/ssl/e-chains.cn/privateKey.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
location / {
# expires -1;
add_header app_remote_addr $remote_addr;
add_header app_proxy_add_x_forwarded_for_ip $proxy_add_x_forwarded_for;
#client_max_body_size 500m;
try_files $uri $uri/ /index.php;
}
root /var/www/html/quzheng/thepeople_web/public;
index index.html index.htm index.nginx-debian.html;
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php.*$ {
root /var/www/html/quzheng/thepeople_web/public; # root 的定义尽量使用绝对变量,决定了变量$document_root
fastcgi_pass unix:/var/run/php-fpm/www.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
apache 环境下不可以用 pcntl_fork 函数
只能在cgi 或命令行下使用。
Nginx 服务器无法获取 $_GET
try_files $uri $uri/ /index.php;
try_files $uri $uri/ /index.php?$args;
nginx 服务器 出现 file not found 是获取文件路径失败,最终发现是$document_root 变量 是 有root 控制的,所以root 要写成绝对地址,防止出现意想不到的结果。
location ~ xxxx {
root xxxx
}
在调试代码的时候,出现500的时候,没有任何提示,可以通过配置的错误日志,查看nginx 服务器的错误。这是调试很重要的一点。