LoginSignup
1
3

More than 3 years have passed since last update.

Nginx の設定ファイル

Last updated at Posted at 2019-11-18

Nginx で PHP,Python,Let's Encrypt を使う時の設定ファイルです。

Ubuntu 18.04 で確認しました。

サーバー名は、example.com とします。

/etc/nginx/sites-available/default
#
server {
        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www/html;

        index index.html index.htm index.php;

        server_name _;

        location / {
                try_files $uri $uri/ =404;
        }

#
        location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.2-fpm.sock;
        }

#
location ~ \.py$ {
        gzip off;
        include fastcgi_params;
        fastcgi_pass unix:/var/run/fcgiwrap.socket;
        fastcgi_index index.py;
        fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
        }
#
        listen  443 ssl;
        server_name     example.com;
        ssl_certificate         /etc/letsencrypt/live/example.com/fullchain.pem;
        ssl_certificate_key     /etc/letsencrypt/live/example.com/privkey.pem;

}
#
1
3
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
3