We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on v1 candidate and expect to engage more with the community over the coming months. We are committed to open source, and we encourage contributors to help us build the future of Vesta.
HTTP downloading php, HTTPS serving php. [SELF-FIXED]
HTTP downloading php, HTTPS serving php. [SELF-FIXED]
SERVER-WIDE ISSUE:
I've run into a weird problem. After a server reboot, HTTP requests download php files, but HTTPS requests serve the php files normally.
What should happen: when you goto http://website.com it should auto-redirect you to the website https://website.com. This was working before the server reboot. Sites automatically redirected to the https & everything worked properly. Now when you goto http://website.com you download the .php file, but going to https://website.com serves the website properly.
OS: Ubuntu 18.04
Vesta: 0.9.8 release 26
PHP: PHP 7.2.24-0ubuntu0.18.04.3
Nginx: nginx/1.17.9
Vesta Setup: NGINX + PHP-FPM
Note: Sites, User, & IP have been redacted as "website.com", "X.X.X.X", & "useraccount".
site.nginx.conf
nginx.ssl.conf is the same except for :443 ssl http2 & the ssl cert key path
I've tried just about everything I can think of to fix this. Any ideas / recommendations?
I've run into a weird problem. After a server reboot, HTTP requests download php files, but HTTPS requests serve the php files normally.
What should happen: when you goto http://website.com it should auto-redirect you to the website https://website.com. This was working before the server reboot. Sites automatically redirected to the https & everything worked properly. Now when you goto http://website.com you download the .php file, but going to https://website.com serves the website properly.
OS: Ubuntu 18.04
Vesta: 0.9.8 release 26
PHP: PHP 7.2.24-0ubuntu0.18.04.3
Nginx: nginx/1.17.9
Vesta Setup: NGINX + PHP-FPM
Note: Sites, User, & IP have been redacted as "website.com", "X.X.X.X", & "useraccount".
site.nginx.conf
Code: Select all
server {
listen X.X.X.X:80;
server_name website.com www.website.com;
root /home/useraccount/web/website.com/public_html;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/website.com.log combined;
access_log /var/log/nginx/domains/website.com.bytes bytes;
error_log /var/log/nginx/domains/website.com.error.log error;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
expires max;
}
location ~ [^/]\.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9026;
include /etc/nginx/fastcgi_params;
fastcgi_cache phpcache;
fastcgi_cache_valid 200 301 302 5m;
fastcgi_cache_use_stale error timeout updating invalid_header http_500 http_503;
fastcgi_cache_min_uses 1;
fastcgi_cache_lock on;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
add_header X-FastCGI-Cache $upstream_cache_status;
}
}
#Wordpress Caching Start
# POST requests and urls with a query string should always go to PHP
if ($request_method = POST) {
set $skip_cache 1;
}
if ($query_string != "") {
set $skip_cache 1;
}
# Don't cache uris containing the following segments
if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|^/feed/*|/tag/.*/feed/*|index.php|/.*sitemap.*\.(xml|xsl)") {
set $skip_cache 1;
}
# Don't use the cache for logged in users or recent commenters
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
set $skip_cache 1;
}
#Wordpress Caching End
error_page 403 /error/404.html;
error_page 404 /error/404.html;
error_page 500 502 503 504 /error/50x.html;
location /error/ {
alias /home/useraccount/web/website.com/document_errors/;
}
location ~* "/\.(htaccess|htpasswd)$" {
deny all;
return 404;
}
location /vstats/ {
alias /home/useraccount/web/website.com/stats/;
include /home/useraccount/conf/web/website.com.auth*;
}
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include /etc/nginx/conf.d/webmail.inc*;
include /home/useraccount/conf/web/snginx.website.com.conf*;
}
Code: Select all
server {
listen X.X.X.X:443 ssl http2;
server_name website.com www.website.com;
root /home/useraccount/web/website.com/public_html;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/website.com.log combined;
access_log /var/log/nginx/domains/website.com.bytes bytes;
error_log /var/log/nginx/domains/website.com.error.log error;
ssl_certificate /home/useraccount/conf/web/ssl.website.com.pem;
ssl_certificate_key /home/useraccount/conf/web/ssl.website.com.key;
Last edited by dwebb on Wed Mar 11, 2020 10:25 pm, edited 1 time in total.
Re: HTTP downloading php, HTTPS serving php.
Looks like all HTTP requests are garbled:
For example this is what I'm receiving when going to a standard robots.txt on a wordpress site:
�����������€������ےےے�������ے����������������
For example this is what I'm receiving when going to a standard robots.txt on a wordpress site:
�����������€������ےےے�������ے����������������
Re: HTTP downloading php, HTTPS serving php.
Diving further into this issue seems to be much more than a VestaCP problem... I will continue to work on this and post a fix when I get one just in the off chance that someone, somewhere, at sometime stumbles across this.
Looks like the same issue this from this response: https://serverfault.com/a/867022
Looks like the same issue this from this response: https://serverfault.com/a/867022