Sec-il-n / dic_issue_aws

0 stars 0 forks source link

Nginx #7

Open Sec-il-n opened 3 years ago

Sec-il-n commented 3 years ago

  以下 issue6にも記載済み

EC2インスタンスのIPアドレスにアクセスして確認

Sec-il-n commented 3 years ago

EC2側での設定

↓カリキュラム(現状 ↓ Nginx confファイル)

upstream unicorn {
    server unix:/var/www/アプリケーション名/shared/tmp/sockets/unicorn.sock;
}
server {
        listen       80;
        server_name  EC2のIPアドレス;

        root /var/www/アプリケーション名/shared/public;
            access_log /var/log/nginx/アプリケーション名_access.log;
            error_log /var/log/nginx/アプリケーション名_error.log;
            location ~ ^/assets/ {
            }
            location / {
                    proxy_set_header X-Real-IP $remote_addr;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                    proxy_set_header Host $http_host;
                    proxy_pass http://unicorn;
            }
    }

追記 postメソッドでもエラーが出ないようにする $ cd /var/lib $ sudo chmod -R 775 nginx 参考

変更前 drwxrwx--- 3 nginx root 17 Mar 8 13:22 nginx

編集後はリロード $ sudo nginx -s reload


Nginx confファイル doc p.8 & /Users/secil/workspace/dic/dic_graduate/EC2側設定ファイル

Sec-il-n commented 3 years ago

編集後はリロード $ sudo nginx -s reload

リスタート コマンド sudo systemctl restart nginx \= sudo /etc/init.d/nginx stop sudo /etc/init.d/nginx start sudo nginx -s reload

Sec-il-n commented 3 years ago

deploy check (ローカル)

bundle exec cap production deploy:check ※ この時点ではERROR linked file /var/www/achieve/shared/.env does not exist on xx.xxx.xxx.xが出る。 →環境変数設定