ssl - 这个服务器 block 应该如何寻找成功的 nginx ssl 安装?

标签 ssl nginx

所以我正在审查这个服务器 block 配置,老实说,它看起来不像我希望的样板,我需要成功安装 ssl。

文件是/etc/nginx/sites-available/example.com:

server {
    listen 80;
    server_name example.com;
    root /home/forge/example.com/public;

    # FORGE SSL (DO NOT REMOVE!)
    # ssl on;
    # ssl_certificate;
    # ssl_certificate_key;

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/biossantibodies.com-error.log error;

    error_page 404 /index.php;

    location ~ \.php$ {
        try_files $uri /404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
#       fastcgi_pass 127.0.0.1:9000;

        fastcgi_index index.php;
        include fastcgi_params;
    }

然后在/etc/nginx/sites-available/www.example.com 中还有另一个文件:

server {
    listen 80;
    listen 443 ssl;
    server_name www.example.com;
    return 301 $scheme://example.com$request_uri;
}

所以我什至不确定我应该在哪一个中工作。

最佳答案

下面有一个很好的例子,说明您需要为 NGINX 配置 ssl。

http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_certificate

关于ssl - 这个服务器 block 应该如何寻找成功的 nginx ssl 安装?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41604095/

相关文章:

postgresql - Power BI Desktop 出现 Npgsql 3.0.3 错误

amazon-s3 - 什么是 RESTful Web 服务最具可扩展性和高性能的 Amazon Web Service (AWS) 配置?

java - 这是 Apache + Tomcat 之间的虚假 SSL 连接吗?

ssl - Apache http core nio 4.3.3反向代理SSL错误

nginx - 将 Google Cloud Storage Bucket 与 GCE LoadBalancer 一起使用...不在主机和路径中

docker - `docker-compose logs` 从哪里拉?

angularjs - 从 token 创建 Django session

nginx - ClusterIP:无和失败的 pods

C++ SSL/HTTPS 301 重定向循环

wordpress - 如何在复杂的设置下提交我的网站以进行适当的 SEO?