1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[nginx]https接続のnginxでPHPを動かす[PHP]

Posted at

nginxでPHPを動かす

httpではPHPが動くのにhttpsで動かない状態を改善する方法をメモとして残します。

nginx/conf.d/default.conf設定に以下を追加します。
rootフォルダは任意に変更してください。

default.conf
server {
        listen 443 ssl http2;
        server_name sample.com;

        if ($request_uri ~ ^.*/index.html$){
        rewrite ^(.*)/index.html$ $1/ permanent;
        }

        location / {
                root   /html;
                index  index.html index.htm index.php;
        }

        ssl_protocols TLSv1.2;
        ssl_ciphers EECDH+AESGCM:EECDH+AES;
        ssl_ecdh_curve prime256v1;
        ssl_prefer_server_ciphers on;
        ssl_session_cache shared:SSL:10m;

        ssl_certificate /etc/letsencrypt/live/sample.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/sample.com/privkey.pem;

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
                root   /html;
        }

        location ~ \.php$ {
        root           /html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
        }
}

以上

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?