nginx -v 查看版本
ps -ef | grep nginx 进程查看
sudo /etc/init.d/nginx {start|restart|stop} 启动|重启|停止
/usr/sbin/nginx -s reload 修改配置后重载
sudo nginx -t -c /etc/nginx/nginx.conf 检查配置
强制https
if ($scheme != "https") {
return 301 https://$host$request_uri;
}
反向代理
location / {
proxy_pass http://127.0.0.1:8080;
}
配置 php站点
server {
listen 80;
listen 443 ssl;
server_name www.grazy.cn grazy.cn;
root /www/grazy.cn;
index index.php index.html index.htm
access_log /var/log/nginx/grazy.cn.access.log;
error_log /var/log/nginx/grazy.cn.error.log;
ssl on;
ssl_certificate /ssl/grazy.cn/xxx.pem;
ssl_certificate_key /ssl/grazy.cn/xxx.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;
if ($scheme != "https") {
return 301 https://$host$request_uri;
}
location / {
}
location ~ \.php$ {
fastcgi_pass php:9000;
include fastcgi-php.conf;
include fastcgi_params;
}
}
网友评论