nginx的配置文件

以下是在Nginx上使用PHP、Python和Let’s Encrypt的配置文件设定。

我已在Ubuntu 18.04上进行验证。

服务器名称设为example.com。

#
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;

}
#
广告
将在 10 秒后关闭
bannerAds