美文网首页
lnmp - 443 - https

lnmp - 443 - https

作者: songyu0 | 来源:发表于2017-07-04 09:37 被阅读59次

##

# You should look at the following URL's in order to grasp a solid understanding

# of Nginx configuration files in order to fully unleash the power of Nginx.

# http://wiki.nginx.org/Pitfalls

# http://wiki.nginx.org/QuickStart

# http://wiki.nginx.org/Configuration

#

# Generally, you will want to move this file somewhere, and start with a clean

# file but keep this around for reference. Or just disable in sites-enabled.

#

# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.

##

# Default server configuration

#

server {

listen 80;

server_name sstmov.com;

# return 301 https://$server_name$request_uri;

root@iZjj3q78xrzfthZ:~# cat /etc/nginx/sites-available/default

##

# You should look at the following URL's in order to grasp a solid understanding

# of Nginx configuration files in order to fully unleash the power of Nginx.

# http://wiki.nginx.org/Pitfalls

# http://wiki.nginx.org/QuickStart

# http://wiki.nginx.org/Configuration

#

# Generally, you will want to move this file somewhere, and start with a clean

# file but keep this around for reference. Or just disable in sites-enabled.

#

# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.

##

# Default server configuration

#

server {

listen 80;

server_name sstmov.com;

# return 301 https://$server_name$request_uri;

# rewrite ^/(.*) https://ssl.lanbing.org/$1 permanent; #关键代码仔细比较两者的跳转的区别

#告诉浏览器有效期内只准用 https 访问

add_header Strict-Transport-Security max-age=15768000;

#永久重定向到 https 站点

return 301 https://$server_name$request_uri;

}

server {

# listen 80 default_server;

# listen [::]:80 default_server;

# SSL configuration

#

listen 443 ssl default_server;

listen [::]:443 ssl default_server;

ssl on;

server_name _;

ssl_certificate  cert/214023913850896.pem;

ssl_certificate_key  cert/214023913850896.key;

# ssl_certificate  (磁盘目录/订单号2.pem -- 购买下载证书的.pem 文件);

# ssl_certificate_key (磁盘目录/订单号2.key -- 购买下载证书的.key 文件);

ssl_session_timeout 5m;

ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

#

# Note: You should disable gzip for SSL traffic.

# See: https://bugs.debian.org/773332

#

# Read up on ssl_ciphers to ensure a secure configuration.

# See: https://bugs.debian.org/765782

#

# Self signed certs generated by the ssl-cert package

# Don't use them in a production server!

#

# include snippets/snakeoil.conf;

# root /var/www/html;

root /var/www/html/yii2-oa/backend/web;

# Add index.php to the list if you are using PHP

index index.php index.html index.htm;

location / {

# First attempt to serve request as file, then

# as directory, then fall back to displaying a 404.

autoindex on;

autoindex_exact_size off;

autoindex_localtime on;

# try_files $uri $uri/ =404;

# try_files $uri /index.php =404;

try_files $uri $uri/ /index.php?$query_string;

}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

#

location ~ \.php$ {

include /etc/nginx/fastcgi_params;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

# fastcgi_param SCRIPT_NAME /var/www/html/yii2-oa/backend/web$fastcgi_script_name;

# include snippets/fastcgi-php.conf;

# With php7.0-cgi alone:

# include /etc/nginx/fastcgi_params;

# fastcgi_pass 127.0.0.1:9000;

# With php7.0-fpm:

# fastcgi_pass unix:/run/php/php7.0-fpm.sock;

# fastcgi_index index.php

# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

# include fastcgi_params;

}

# deny access to .htaccess files, if Apache's document root

# concurs with nginx's one

#

#location ~ /\.ht {

# deny all;

#}

# location / {

#  if (!-e $request_filename){

#      rewrite ^/(.*) /index.php last;

# }

# }

}

# 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 example.com;

#

# root /var/www/example.com;

# index index.html;

#

# location / {

# try_files $uri $uri/ =404;

# }

#}

相关文章

网友评论

      本文标题:lnmp - 443 - https

      本文链接:https://www.haomeiwen.com/subject/tnythxtx.html