Всем привет!
Настроена связка nginx + apache2 по
https://interface31.ru/tech_it/2016/08/nastraivaem-veb-server-nginx-kak-front-end-k-apache.htmlТеперь понадобилось к одному домену добавить ssl. Использую бесплатный сертификат от Let's Encrypt. Все файлы с генерировались.
Настроил ssl в конфиге nginx. html открывается отлично через https, но если запросить файл php, то получаю этот файл на скачивание.
Обращаюсь к этому же файлу через http - все отрабатывает. Подскажите, пожалуйста, в чем дело?
Конфиг виртуального хоста nginx
server {
listen 80;
server_name some-domain.ru www.some-domain.ru;
root /var/www/test;
charset utf-8;
access_log /var/log/nginx/test.access.log main;
error_log /var/log/nginx/test.error.log error;
index index.html index.php;
include /etc/nginx/templates/apache24.conf;
location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root /var/www/letsencrypt;
}
location = /.well-known/acme-challenge/ {
return 404;
}
rewrite ^ https://some-domain.ru$request_uri? permanent;
}
server {
server_name some-domain.ru;
listen 443 ssl http2;
root /var/www/test;
charset utf-8;
index index.php index.html
include /etc/nginx/templates/apache24.conf;
ssl on;
#ssl_session_timeout 10m;
ssl_certificate /etc/letsencrypt/live/some-domain.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/some-domain.ru/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/some-domain.ru/chain.pem;
ssl_dhparam /etc/letsencrypt/live/some-domain.ru/dhparam.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
add_header Strict-Transport-Security "max-age=31536000;";
}
apache24.conf
location / {
proxy_pass http://apache24;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 120;
proxy_send_timeout 120;
proxy_read_timeout 180;
}
location ~* \.(gif|jpeg|jpg|gif|txt|png|tif|tiff|ico|jng|bmp|doc|pdf|rtf|xls|ppt|rar|rpm|swf|zip|bin|exe|dll|deb|cur)$ {
access_log off;
expires 3d;
}
location ~* \.(css|js)$ {
access_log off;
expires 180m;
}
location ~ /\.ht {
deny all;
}
Конфиг виртуального хоста apache
<VirtualHost *:8080>
ServerName some-domain.ru
ServerAlias www.some-domain.ru
ServerAdmin webmaster@localhost
DocumentRoot /var/www/test
SetEnvIf X-Forwarded-Proto https HTTPS=on
ErrorLog ${APACHE_LOG_DIR}/test.error.log
CustomLog ${APACHE_LOG_DIR}/test.access.log combined
RewriteEngine On
<Directory /var/www/test>
AllowOverride All
Options -Includes -Indexes -ExecCGI +FollowSymLinks
DirectoryIndex index.php
Require all granted
</Directory>
</VirtualHost>