Оценок пока нет Перенос WordPress с Apache на Nginx + php-fpm

Для нам потребуется создать новый файл конфигурации сайта в папке sites-available со следующим содержимым

server {
        server_name example.com www.example.com;
        root /var/www/example.com/public_html;
        index index.php;
	access_log /var/www/example.com/logs/example.com.access.log;
	error_log /var/www/example.com/logs/example.com.error.log;
	
    location / {
      try_files $uri $uri/ /index.php?$args;
    }
	
    location ~ \.php$ {
        root /var/www/example.com/public_html;
        fastcgi_pass   unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }


    location ~ /\.ht {
      deny  all;
    }

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
    if ($host = wsofter.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


        listen 80;
        listen [::]:80;

        server_name example.com www.example.com;
    return 404; # managed by Certbot


}

Чтобы генерировать SSL сертификаты для домена можно почитать про сервисы для генерации на официальной странице или сразу же воспользоваться популярным клиентом для Linux Certbot.

Пожалуйста, оцените материал

WebSofter

Web - технологии