我一直在尝试构建一个Docker容器来在我的自定义域上设置Nginx,例如example.com,使用SSL。这是我的Dockerfile
FROM node:latest as build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY ./ .
RUN npm run build
FROM nginx as production-stage
RUN mkdir /app
COPY --from=build-stage /app/dist /app
COPY nginx.conf /etc/nginx/nginx.
我已经成功地通过certbot将SSL安装到我的Nginx容器中,但是在安装之后,通过HTTPS路由的所有通信都拒绝连接。
curl https://www.example.com或curl https://the_ip_of_server
curl: (7) Failed to connect to example.com port 443 after 9822 ms: Connection refused
~Port 443在服务器上打开()
curl http://www.example.com
301 Moved Permanently
301 Moved Permanently
n
我的nginx.conf文件如下:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
#the above include brings in the following default files:
#50-mod-http-image-filter.conf
#50-mod-http-xslt-filter.conf
#50-mod-mail.conf
#50-mod-stream.conf
events {
我试图在Ubuntu16.04上加密Nginx。
获得SSL证书之前的example.conf文件
server {
server_name example.com www.example.com ;
# Tell Nginx and Passenger where your app's 'public' directory is
root /var/www/backup/mycode/public;
# Turn on Passenger
passenger_enabled on;
rails_env developme
以下是当前的状态:
http://example.com to https://www.example.com works
http://www.example.com to https://www.example.com works
https://example.com to https://www.example.com不会重定向--只是解析到https://example.com
尝试了多次吐露,但仍然得到了同样的结果。不确定这是否是配置字段中元素的顺序,如果我只是完全错配置了。
配置文件:
server {
server_name www.example.com exampl