My problem is that I have a CentOS Web Panel:
Where I have an Nginx Reverse Proxy running on port 80/443 which is forward the requests to Apache 2.4.52 on port 8181. The modules that Apache uses are:
Loaded Modules:
core_module (static)
so_module (static)
http_module (static)
mpm_event_module (static)
authn_file_module (shared)
authn_core_module (shared)
authz_host_module (shared)
authz_groupfile_module (shared)
authz_user_module (shared)
authz_core_module (shared)
access_compat_module (shared)
auth_basic_module (shared)
reqtimeout_module (shared)
filter_module (shared)
deflate_module (shared)
mime_module (shared)
log_config_module (shared)
env_module (shared)
expires_module (shared)
headers_module (shared)
unique_id_module (shared)
setenvif_module (shared)
version_module (shared)
proxy_module (shared)
proxy_connect_module (shared)
proxy_http_module (shared)
unixd_module (shared)
status_module (shared)
autoindex_module (shared)
dir_module (shared)
userdir_module (shared)
alias_module (shared)
rewrite_module (shared)
ssl_module (shared)
security2_module (shared)
proxy_fcgi_module (shared)
rpaf_module (shared)
suphp_module (shared)
The Apache uses PHP-FPM 8.0.20 currently On this webserver,i have a Wordpress installation, with WebP Express. I used it on other hostings and pages, but currently it's not working, it says, that I don't have mod_headers installed. I tried it and mod_headers working, i was able to change the cache and other headers, but somehow, it's not redirect me to the .webp images.
Currently in this example on other hosting if I ask for an image from the server i got these headers: URL: https://www.workingexampleurl.com/wp-content/uploads/2022/05/test.png
date: Tue, 26 Jul 2022 09:56:25 GMT
server: Apache
last-modified: Thu, 19 May 2022 16:26:32 GMT
etag: "dcf6-5df5fd632cd92"
accept-ranges: bytes
content-length: 56566
vary: Accept
x-webp-express: Redirected directly to existing webp
cache-control: private, max-age=2592000
content-type: image/webp
On this hosting setup somehow i got this: URL: https://notworkingexampleurl.com/wp-content/uploads/2022/07/test.png
server: nginx/1.22.0
date: Tue, 26 Jul 2022 09:59:37 GMT
content-type: image/png
content-length: 46758
last-modified: Thu, 21 Jul 2022 15:12:12 GMT
connection: keep-alive
keep-alive:timeout=60
vary: Accept-Encoding
etag: "62d96ccc-b6a6"
expires: Thu, 31 Dec 2037 23:55:55 GMT
cache-control: max-age=315360000
x-cache: HIT from Backend
strict-transport-security: max-age=31536000
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
accept-ranges: bytes
And when i tried the same domain with the apache 8181 port i got these headers back from the server:
Date: Tue, 26 Jul 2022 10:27:09 GMT
Server: Apache/2.4.52 (Unix) OpenSSL/1.0.2k-fips
Vary: Accept,User-Agent
Last-Modified: Tue, 26 Jul 2022 08:22:25 GMT
ETag: "7fc6-5e4b1001bf660"
Accept-Ranges: bytes
Content-Length: 32710
X-WebP-Express: Redirected directly to existing webp
Content-Type: image/webp
In the /etc/nginx/proxy.inc file i have these:
#More info here: http://wiki.nginx.org/HttpProxyModule
proxy_buffering off;
proxy_connect_timeout 59s;
proxy_send_timeout 600;
proxy_read_timeout 600;
proxy_buffer_size 64k;
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_pass_header Set-Cookie;
proxy_redirect off;
#proxy_hide_header Vary;
proxy_hide_header X-Powered-By;
proxy_set_header Accept-Encoding '';
#If you want to get the cache-control and expire headers from apache, comment out 'proxy_ignore_headers' and uncomment 'proxy_pass_header Expires;' and 'proxy_pass_header Cache-Control
proxy_pass_header Expires;
proxy_pass_header Cache-Control;
proxy_pass_header Vary;
#proxy_pass_request_headers on;
#proxy_ignore_headers Cache-Control Expires;
proxy_set_header Referer $http_referer;
proxy_set_header Host $host;
proxy_set_header Cookie $http_cookie;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
And this is the config for the vhost on nginx proxy: /etc/nginx/conf.d/vhosts/notworkingexample.hu.ssl.conf
server {
listen 192.168.1.15:443 ssl ;
server_name notworkingexample.hu www.notworkingexample.hu;
access_log /usr/local/apache/domlogs/notworkingexample.hu.bytes bytes;
access_log /usr/local/apache/domlogs/notworkingexample.hu.log combined;
error_log /usr/local/apache/domlogs/notworkingexample.hu.error.log error;
ssl_certificate /etc/pki/tls/certs/notworkingexample.hu.bundle;
ssl_certificate_key /etc/pki/tls/private/notworkingexample.hu.key;
ssl_protocols TLSv1.2;
ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA!RC4:EECDH:!RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 60m;
location / {
location ~.*\.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|html|htm|txt|js|css|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso|woff|ttf|svg|eot|sh|webp)$ {
root /home/superuser/public_html/notworkingexample.hu;
expires max;
try_files $uri $uri/ @backend;
}
error_page 405 = @backend;
error_page 500 = @custom;
add_header X-Cache "HIT from Backend";
add_header Strict-Transport-Security "max-age=31536000";
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
proxy_pass http://192.168.1.15:8181;
include proxy.inc;
}
location @backend {
internal;
proxy_pass http://192.168.1.15:8181;
include proxy.inc;
}
location @custom {
internal;
proxy_pass http://192.168.1.15:8181;
include proxy.inc;
}
location ~ .*\.(php|jsp|cgi|pl|py)?$ {
proxy_pass http://192.168.1.15:8181;
include proxy.inc;
}
location ~ /\.ht {deny all;}
location ~ /\.svn/ {deny all;}
location ~ /\.git/ {deny all;}
location ~ /\.hg/ {deny all;}
location ~ /\.bzr/ {deny all;}
disable_symlinks if_not_owner from=/home/superuser/public_html/notworkingexample.hu;
location /.well-known/acme-challenge {
default_type "text/plain";
alias /usr/local/apache/autossl_tmp/.well-known/acme-challenge;
}
location /.well-known/pki-validation {
default_type "text/plain";
alias /usr/local/apache/autossl_tmp/.well-known/acme-challenge;
}
}
And lastly this is the config for the current domain, /usr/local/apache/conf.d/vhosts/notworkingexample.hu.conf that is not working:
<VirtualHost 192.168.1.15:8181>
ServerName notworkingexample.hu
ServerAlias www.notworkingexample.hu
ServerAdmin webmaster@notworkingexample.hu
DocumentRoot /home/superuser/public_html/notworkingexample.hu
UseCanonicalName Off
ScriptAlias /cgi-bin/ /home/superuser/public_html/notworkingexample.hu/cgi-bin/
#CustomLog /usr/local/apache/domlogs/notworkingexample.hu.bytes bytes
#CustomLog /usr/local/apache/domlogs/notworkingexample.hu.log combined
ErrorLog /usr/local/apache/domlogs/notworkingexample.hu.error.log
# Custom settings are loaded below this line (if any exist)
IncludeOptional "/usr/local/apache/conf/userdata/superuser/notworkingexample.hu/*.conf"
<IfModule mod_setenvif.c>
SetEnvIf X-Forwarded-Proto "^https$" HTTPS=on
</IfModule>
<IfModule mod_userdir.c>
UserDir disabled
UserDir enabled superuser
</IfModule>
<IfModule mod_suexec.c>
SuexecUserGroup superuser superuser
</IfModule>
<IfModule mod_suphp.c>
suPHP_UserGroup superuser superuser
suPHP_ConfigPath /home/superuser
</IfModule>
<IfModule mod_ruid2.c>
RMode config
RUidGid superuser superuser
</IfModule>
<IfModule itk.c>
AssignUserID superuser superuser
</IfModule>
<Directory "/home/superuser/public_html/notworkingexample.hu">
AllowOverride All
Require all granted
</Directory>
<IfModule proxy_fcgi_module>
<FilesMatch \.php$>
SetHandler "proxy:unix:/opt/alt/php-fpm80/usr/var/sockets/superuser.sock|fcgi://localhost"
</FilesMatch>
</IfModule>
</VirtualHost>
Any suggestion would be great!