配置nginx:
vim /etc/nginx/sites-available/default
如下是我的配置文件:
server {
#强制http2
listen 443 ssl http2;
#ssl证书目录
ssl_certificate /etc/zhengshu/1_www.lstazl.com_bundle.crt;
ssl_certificate_key /etc/zhengshu/2_www.lstazl.com.key;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name lstazl.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?$args;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php7.0-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
server {
listen 80;
listen [::]:80;
server_name lstazl.com;
root /var/www/html;
index index.php index.htm index.jsp index.do index.aspx index.html;
#设置301跳转,也就是强制https
return 301 http://94.191.62.134$request_uri;
}
