How-to: mod_pagespeed for apache

How would I verify if mod_ruid2 is installed or not. And what is advantage of using it. As per my understanding it does not allow php scripts to modify the folder outside of its containing folder?

Code:
/usr/local/directadmin/directadmin c | grep -i ruid

OR

Code:
httpd -M | grep -i ruid
 
Hi issued the second command and I got some warnings along with output can you please explain why this warnings?
 

Attachments

  • Screenshot_20200413-075648_Mobile SSH.jpg
    Screenshot_20200413-075648_Mobile SSH.jpg
    308.8 KB · Views: 20
I get the same:

Code:
[root@host ~]# httpd -M | grep -i ruid
AH00112: Warning: DocumentRoot [/home/res1/domains/sharedip] does not exist
AH00112: Warning: DocumentRoot [/home/res1/domains/sharedip] does not exist
AH00112: Warning: DocumentRoot [/home/admin/subdomains/custom/custom] does not exist
AH00112: Warning: DocumentRoot [/home/admin/subdomains/custom/custom] does not exist
AH00112: Warning: DocumentRoot [/home/res1/customdocroot/] does not exist
AH00112: Warning: DocumentRoot [/home/res1/customdocroot/] does not exist
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using host.n3rd.ga. Set the 'ServerName' directive globally to suppress this message
[root@host ~]#

These warnings are warning you of docroots that are set in the apache configuration but don't exist.

For example, I just tested the sharedip docroot, which I found in file /etc/httpd/conf/ips.conf as the docroot for my secondary, shared ip (shared between resellers).

Since it didn't exist, loading my secondary shared ip in the browser didn't load anything other than a 404 Not Found. So tested further like this:
Code:
[root@host ~]# mkdir  -p /home/res1/domains/sharedip
[root@host ~]# nano /home/res1/domains/sharedip/index.html
[root@host ~]# cat /home/res1/domains/sharedip/index.html
<h1>docroot for shared ip</h1>
[root@host ~]#

I then entered my shared ip in the browser, and viola! It loaded 'docroot for shared ip'.


The other is because I have custom docroots set for testing at one point but the directory I set them do doesn't exist, just like with the secondary shared ip... it looks like I may have deleted the directory and its content but not the custom docroots from the apache conf:

Code:
[root@host ~]# grep -i docroot /usr/local/directadmin/data/users/*/httpd.conf
/usr/local/directadmin/data/users/res1/httpd.conf:    DocumentRoot /home/res1/customdocroot/
/usr/local/directadmin/data/users/res1/httpd.conf:    ScriptAlias /cgi-bin/ /home/res1/customdocroot//cgi-bin/
/usr/local/directadmin/data/users/res1/httpd.conf:    <Directory /home/res1/customdocroot/>
/usr/local/directadmin/data/users/res1/httpd.conf:    DocumentRoot /home/res1/customdocroot/
/usr/local/directadmin/data/users/res1/httpd.conf:    <Directory /home/res1/customdocroot/>
[root@host ~]#

Code:
[root@host ~]# ll /home/res1/customdocroot/
ls: cannot access /home/res1/customdocroot/: No such file or directory
[root@host ~]#
 
If you want to disable mod_ruid2, don't forget to disable it in options.conf
mod_ruid2=yes
should become
mod_ruid2=no

Don't forget to do a ./build update and rebuild apache afterwards.
 
Hi,I think pagespeed is causing issues on apache shutting down and restart continuously please tell me how would i uninstall the pagespeed module?
 
Hello i am also getting Permission denied Could not create directories error. I have checked mod ruid not installed. Any idea how to fix this, permission for cache folder

drwxr-xr-x. 7 root root 76 Nov 27 14:51 cache
drwxr-xr-x 2 root root 6 Nov 27 14:51 cache/mod_pagespeed/



Code:
[Tue, 01 Dec 2020 22:31:16 GMT] [Error] [463] Failed to make directory /var/cache/mod_pagespeed/shm_metadata_cache: Permission denied
[Tue, 01 Dec 2020 22:31:16 GMT] [Error] [463] Could not create directories for file /var/cache/mod_pagespeed/shm_metadata_cache/snapshot/pagespeed_default_shm/metadata_cache/1/64/4452/128/42,.temp
[Tue, 01 Dec 2020 22:31:16 GMT] [Error] [463] [/var/cache/mod_pagespeed/shm_metadata_cache/snapshot/pagespeed_default_shm/metadata_cache/1/64/4452/128/42,.temptWzVBr:0] opening temp file: No such file or directory
[Tue, 01 Dec 2020 22:31:16 GMT] [Error] [463] [/var/log/pagespeed/stats_log_global:0] opening output file: Permission denied
[Tue, 01 Dec 2020 22:31:16 GMT] [Error] [463] Error opening statistics log file /var/log/pagespeed/stats_log_global.
[Tue, 01 Dec 2020 22:31:17 GMT] [Error] [463] [/var/cache/mod_pagespeed/cache.purge.tempycVpRq:0] opening temp file: Permission denied
[Tue, 01 Dec 2020 22:31:17 GMT] [Error] [463] [/var/cache/mod_pagespeed/cache.purge.temp3KWU6p:0] opening temp file: Permission denied
[Tue, 01 Dec 2020 22:31:17 GMT] [Error] [463] [/var/cache/mod_pagespeed/cache.purge.tempQRhqmp:0] opening temp file: Permission denied

Thanks
 
Hello i am also getting Permission denied Could not create directories error. I have checked mod ruid not installed. Any idea how to fix this, permission for cache folder

drwxr-xr-x. 7 root root 76 Nov 27 14:51 cache
drwxr-xr-x 2 root root 6 Nov 27 14:51 cache/mod_pagespeed/



Code:
[Tue, 01 Dec 2020 22:31:16 GMT] [Error] [463] Failed to make directory /var/cache/mod_pagespeed/shm_metadata_cache: Permission denied
[Tue, 01 Dec 2020 22:31:16 GMT] [Error] [463] Could not create directories for file /var/cache/mod_pagespeed/shm_metadata_cache/snapshot/pagespeed_default_shm/metadata_cache/1/64/4452/128/42,.temp
[Tue, 01 Dec 2020 22:31:16 GMT] [Error] [463] [/var/cache/mod_pagespeed/shm_metadata_cache/snapshot/pagespeed_default_shm/metadata_cache/1/64/4452/128/42,.temptWzVBr:0] opening temp file: No such file or directory
[Tue, 01 Dec 2020 22:31:16 GMT] [Error] [463] [/var/log/pagespeed/stats_log_global:0] opening output file: Permission denied
[Tue, 01 Dec 2020 22:31:16 GMT] [Error] [463] Error opening statistics log file /var/log/pagespeed/stats_log_global.
[Tue, 01 Dec 2020 22:31:17 GMT] [Error] [463] [/var/cache/mod_pagespeed/cache.purge.tempycVpRq:0] opening temp file: Permission denied
[Tue, 01 Dec 2020 22:31:17 GMT] [Error] [463] [/var/cache/mod_pagespeed/cache.purge.temp3KWU6p:0] opening temp file: Permission denied
[Tue, 01 Dec 2020 22:31:17 GMT] [Error] [463] [/var/cache/mod_pagespeed/cache.purge.tempQRhqmp:0] opening temp file: Permission denied

Thanks
If you have mod_ruid2 enabled, I'd suggest disabling it.
 
If you have mod_ruid2 enabled, I'd suggest disabling it.
Not using mod ruid2,
/usr/local/directadmin/directadmin c | grep -i ruid
no output
enabled module
Code:
core_module (static)
authn_file_module (static)
authn_dbm_module (static)
authn_anon_module (static)
authn_dbd_module (static)
authn_socache_module (static)
authn_core_module (static)
authz_host_module (static)
authz_groupfile_module (static)
authz_user_module (static)
authz_dbm_module (static)
authz_owner_module (static)
authz_dbd_module (static)
authz_core_module (static)
access_compat_module (static)
auth_basic_module (static)
auth_form_module (static)
auth_digest_module (static)
allowmethods_module (static)
file_cache_module (static)
cache_module (static)
cache_disk_module (static)
cache_socache_module (static)
socache_shmcb_module (static)
socache_dbm_module (static)
socache_memcache_module (static)
socache_redis_module (static)
so_module (static)
watchdog_module (static)
macro_module (static)
dbd_module (static)
dumpio_module (static)
buffer_module (static)
ratelimit_module (static)
reqtimeout_module (static)
ext_filter_module (static)
request_module (static)
include_module (static)
filter_module (static)
substitute_module (static)
sed_module (static)
deflate_module (static)
http_module (static)
mime_module (static)
log_config_module (static)
log_debug_module (static)
logio_module (static)
env_module (static)
expires_module (static)
headers_module (static)
unique_id_module (static)
setenvif_module (static)
version_module (static)
remoteip_module (static)
proxy_module (static)
proxy_connect_module (static)
proxy_ftp_module (static)
proxy_http_module (static)
proxy_fcgi_module (static)
proxy_scgi_module (static)
proxy_uwsgi_module (static)
proxy_fdpass_module (static)
proxy_wstunnel_module (static)
proxy_ajp_module (static)
proxy_balancer_module (static)
proxy_express_module (static)
proxy_hcheck_module (static)
session_module (static)
session_cookie_module (static)
session_dbd_module (static)
slotmem_shm_module (static)
ssl_module (static)
http2_module (static)
lbmethod_byrequests_module (static)
lbmethod_bytraffic_module (static)
lbmethod_bybusyness_module (static)
lbmethod_heartbeat_module (static)
unixd_module (static)
systemd_module (static)
dav_module (static)
status_module (static)
autoindex_module (static)
info_module (static)
suexec_module (static)
cgi_module (static)
dav_fs_module (static)
dav_lock_module (static)
vhost_alias_module (static)
negotiation_module (static)
dir_module (static)
actions_module (static)
speling_module (static)
userdir_module (static)
alias_module (static)
rewrite_module (static)
security2_module (shared)
mpm_event_module (shared)
pagespeed_module (shared)

I have pagespeed_global_admin active and message history is filling up with errors. Followed first post for install.
Thanks
 
I got it working by granting permission to apache to cache/mod_pagespeed/ & log/pagespeed

chown apache:root log/pagespeed
chown apache:root cache/mod_pagespeed

Not sure if missed these instructions, can you please update instructions for others who might follow. All other folders "httpd,exim,modsec_audit..." have their group permissions.
Thanks
 
Due to some requests that people find it difficult to install mod_pagespeed, I'm just writing a guide for now :) As DirectAdmin does not use RPM for Apache, and mod_pagespeed provides 'source installation' packages only for nginx, it creates difficulties for some end-customers. However, it's not as hard to install it.

Guide for CentOS.

We download RPM and extract it:
Code:
mkdir -p /root/mod_pagespeed
cd /root/mod_pagespeed
wget -O mod-pagespeed-stable_current_x86_64.rpm https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm
rpm2cpio mod-pagespeed-stable_current_x86_64.rpm| cpio -idmv

Now we just move files to appropriate places:
Code:
mv -f ./etc/httpd/conf.d/pagespeed.conf /etc/httpd/conf/extra/pagespeed.conf
mv -f ./etc/httpd/conf.d/pagespeed_libraries.conf /etc/httpd/conf/extra/pagespeed_libraries.conf
mv -f ./usr/bin/pagespeed_js_minify /usr/bin/pagespeed_js_minify
mv -f ./usr/lib64/httpd/modules/mod_pagespeed_ap24.so /usr/lib/apache/mod_pagespeed_ap24.so
mkdir -p /var/cache/mod_pagespeed
mkdir -p /var/log/pagespeed

Replace '/usr/lib64/httpd/modules/' path to '/usr/lib/apache/' in /etc/httpd/conf/extra/pagespeed.conf:
Code:
perl -pi -e 's|/usr/lib64/httpd/modules/|/usr/lib/apache/|g' /etc/httpd/conf/extra/pagespeed.conf

And include pagespeed.conf and pagespeed_libraries.conf to be loaded, just edit /etc/httpd/conf/extra/httpd-includes.conf, and add these lines:
Code:
Include /etc/httpd/conf/extra/pagespeed.conf
Include /etc/httpd/conf/extra/pagespeed_libraries.conf

Restart apache now:
Code:
service httpd restart


Hi, Is this the same procedure for Nginx + Apache ?
 
Hi, Is this the same procedure for Nginx + Apache ?
I'd suggest having pagespeed on nginx side, even if it'd work on Apache too :) What's the main reason you'd like to use pagespeed for? As HTTP/2 sends all the content in a single connection, thus "combined" css, js, image sprites don't add any benefits anymore.
 
Are there any advantages, to use it in Litespeed (Pro) environment, with its caching plugins? It seems to make almost the same, so I`m not in the hunt for new troubles, but would like to know if it can speedup even litespeed?
 
I'd suggest having pagespeed on nginx side, even if it'd work on Apache too :) What's the main reason you'd like to use pagespeed for? As HTTP/2 sends all the content in a single connection, thus "combined" css, js, image sprites don't add any benefits anymore.
I have To Slow Website, One website in entire VPS.
 
it this till useful? even if we are using nginx + apache? please let me know im looking forward to it!
 
Back
Top