ドメインに繋げるNginxで決まってる8081 port
エンジニア達、お疲れ様です。
フロントエンドエンジニアとして、なんでものアプリが作れますが、インフラはちょっと詳しくなくて、
Google Cloud Serviceでアプリをデプロイしたいのですが、ドメインに繋げられないですので、
どこでミスしているか誰か教えていただければ、すごく助かります。
ツール
ドメイン : Google domain
サーバー : Google Cloud Service / compute engine / Centos 7.0;
開発環境 : Docker / Docker-compose / Nginx
現在の状態
Dockerfile
FROM nginx WORKDIR /usr/share/nginx/html COPY ./client/dist ./ COPY ./docker/nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]
docker-compose
app: build: context: . dockerfile: ./Dockerfile environment: - NODE_ENV=prod - PORT=8081 volumes: - /usr/share/nginx/html ports: - "8081:80"
Nginx
server { listen 80; server_name example.net; root /usr/share/nginx/html; index index.html; charset utf-8; # enable gzip gzip on; gzip_disable "msie6"; gzip_comp_level 6; gzip_min_length 1100; gzip_buffers 16 8k; gzip_proxied any; gzip_types text/plain text/css text/js text/xml text/javascript application/javascript application/x-javascript application/json application/xml application/rss+xml image/svg+xml; location ~* ^.+.(ico|gif|jpg|jpeg|png)$ { expires 30d; } location ~* ^.+.(css|js|txt|xml|swf|wav)$ { expires 24h; } location ~* ^.+.(html|htm)$ { expires 1h; } location ~* ^.+.(eot|ttf|otf|woff|svg)$ { expires max; } location / { proxy_pass http://localhost:8081; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_read_timeout 1800; proxy_connect_timeout 1800; try_files $uri /index.html; } }
Google Cloud Firewall
問題
example.net; (もちろん購入しているドメインになっておりますが、ここでexample.netを書かさせていただきます。)
example.net:8081で画面を開くと、アプリがちゃんと見れますが、ただexample.netで見れるようにしたいですが、うまく出来ていないです。
上記の状態でどこでミスしているか教えていただければ・・・神様を呼んであげます。
よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。