What is safe way to change httpd.conf in directadmin

Amit

Verified User
Joined
Mar 24, 2020
Messages
129
Location
India
Hi,
Please suggest what is safe way to modify httpd.conf in directadmin I need it to modify it I want to Turn of mod pagespeed for all domain and allow it only via htaccess modification of particular domain.
 
Yes. With the same guide. But I am getting a lot of apache error like mod page speed can not access directory permission denied type of messages. So I want to disable it globly and only allow the domain want use it through its htaccess modifications.
 
Hi @Amit !

I'm not 100% certain without installing and testing for myself, but I'd try the following (make a backup of any files modified first!):

Code:
nano /etc/httpd/conf/extra/pagespeed.conf

Add the following *if* the <IfModule pagespeed_module> section doesn't already exist:

Code:
<IfModule pagespeed_module>
ModPagespeed off
</IfModule>

If the <IfModule pagespeed_module> section does exist already, change ModPageSpeed value to off. This should set it to Off by default for all domains.

Restart Apache and then, try to enable it on your domain by adding the following to it's .htaccess file:

Code:
<IfModule pagespeed_module>
ModPagespeed on
</IfModule>
Now, use curl to test for mod_pagespeed headers being returned for that one domain:

Code:
curl -I domain.tld | grep -i pagespeed

Let me know if this works for you, please! :)
 
If that works, don't forget to create a copy in:
/usr/local/directadmin/custombuild/custom/ap2/conf/extra
otherwise the file will be overwritten on the next update and you will loose your changes made.
 
Copy of which file? pagespeed.conf?
I have not made any changes yet but will update once done
 
Hi seems you have not read scriptkitty steps she is tell me to change in pagespeed.conf file which is included in httpd-include.conf and the link you sent is saying safe to make changes in httpd-include.conf?correct me if I am wrong.
 
Seems rather you don't read my reply's very well and neither the link I posted, because that was for httpd.conf and the httpd-include.conf was just another example.
So yo have to read the help files better to understand what to do. ;)

You also just overlooked my first line which is the most important here.
Als read back my reply #5 on how to do it (which also prooves I very well did read Scriptkiddy's reply!).

So it doesn't matter which file is adjusted. If you want to keep the changes, copy the adjusted file to the correct place which I wrote.

The important thing here, is that if you make changes to httpd files, you have to copy them to the correct directory.
So changes to httpd.conf go to the /ap2/conf directory under custom and changes to httpd files in the /conf/extra directory go to ap2/conf/extra directory.
If you are busy with pagespeed.conf why ask what to copy? That's pagespeed.conf ofcourse.
 
OK got you the help file says
2) If you only need to add extra Apache config code to the system, but don't need to remove any existing code, the best way is to add your changes to:
/etc/httpd/conf/extra/httpd-includes.conf

as this file will not be touched by CustomBuild or DirectAdmin. If it doesn't exist, DA will 'touch' it so that it exists, but any changes you add there will be safe from any external changes.


So why not put my extra code in httpd-includes.conf as changes inside it will be persistent and safe from overwrite. Why should I make changes in pagespeed.conf and making copy of it into ap2/conf/extra I will do the changes directly in httpd-includes.conf file.?
 
Yes I'm sorry. For this httpd-include.conf file indeed there is no need to copy it to the custom directory.

1 is the official way as it says.
2 is an alternative way to only add extra apache config code.

You can try to put the extra code in httpd-includes.conf and they should be persistend indeed and protected from overwrite.
I never used the httpd-include.conf file yet, so I can't guarantee working with that, you would have to try.

There are 2 options. If you use scriptkiddy's solution, you have to copy the file into the custom directory so it won't be overwritten.
In case you use the httpd-includes.conf (if that works in your case) then you don't need to copy anything, you only have to use the httpd-include.conf if all is well.

Don't forget to use the ./build rewrite_confs afterwards.
 
Is does what the name says. :)
If you change things you need it working on the domains so it rewrites the configs to include your changes.
The ./build rewrite_confs command does no harm, you can do that anytime you want. But you normally only use it when making changes to webserver config.
 
OK but in article installing mod pagespeed in directadmin the administrator does not mentioned this command? As in installation procedure he is modify the httpd-include. conf file.
 
It's mentioned in step 1.

As said, the commend can do no harm. If you don't want do run it, don't run it, I don't mind.
But don't complaint if things don't work afterwards.
 
i issued the ./build/rewrite_conf command it give me following message ?
Apache 2.4.27 and higher will not negotiate http2 with mpm_prefork. Please do not use mod_php or disable http2 in the directadmin.conf
 
Hi @Amit !

I'm not 100% certain without installing and testing for myself, but I'd try the following (make a backup of any files modified first!):

Code:
nano /etc/httpd/conf/extra/pagespeed.conf

Add the following *if* the <IfModule pagespeed_module> section doesn't already exist:

Code:
<IfModule pagespeed_module>
ModPagespeed off
</IfModule>

If the <IfModule pagespeed_module> section does exist already, change ModPageSpeed value to off. This should set it to Off by default for all domains.

Restart Apache and then, try to enable it on your domain by adding the following to it's .htaccess file:

Code:
<IfModule pagespeed_module>
ModPagespeed on
</IfModule>
Now, use curl to test for mod_pagespeed headers being returned for that one domain:

Code:
curl -I domain.tld | grep -i pagespeed

Let me know if this works for you, please! :)

Hi scriptkitty i followed your instructions with one modification that have made changes in httpd-includes.conf instead of pagespeed.conf for being safe from override on updates and it works! here is output of after before changing changing the .htaccess of domain.Thanks for your solution.:)(y)

[root@server9 custombuild]# curl -I c9solution.com
HTTP/1.1 200 OK
Date: Mon, 13 Apr 2020 07:09:18 GMT
Server: Apache/2
Last-Modified: Mon, 13 Apr 2020 06:57:50 GMT
ETag: "0-5a32699f25d4c"
Accept-Ranges: bytes
Vary: User-Agent
Content-Type: text/html

[root@server9 custombuild]# curl -I c9solution.com
HTTP/1.1 200 OK
Date: Mon, 13 Apr 2020 07:09:36 GMT
Server: Apache/2
Accept-Ranges: bytes
X-Mod-Pagespeed: 1.13.35.2-0
Vary: User-Agent
Cache-Control: max-age=0, no-cache
Content-Type: text/html
 
Hi scriptkitty i followed your instructions with one modification that have made changes in httpd-includes.conf instead of pagespeed.conf for being safe from override on updates and it works! here is output of after before changing changing the .htaccess of domain.Thanks for your solution.:)(y)
Awesome! And the Pagespeed header is absent for the other domains when testing via curl? If so, then that is great!

Regarding DSO (mod_php) and http/2, they're incompatible (http/2 is also incompatible with mpm prefork and itk). You might try php-fpm and mpm_event if you want to run http/2, but php-fpm does use more RAM.
 
The trick of pagespeed is working i have tested on another domain it working fine.
When i change mode to php-fpm it still using HTTP/1.1 not Http/2? here is header of the domain
HTTP/1.1 200 OK
Date: Mon, 13 Apr 2020 12:14:04 GMT
Server: Apache/2
Accept-Ranges: bytes
X-Mod-Pagespeed: 1.13.35.2-0
Vary: User-Agent
Cache-Control: max-age=0, no-cache
Content-Type: text/html
 
Apache 2.4.27 and higher will not negotiate http2 with mpm_prefork. Please do not use mod_php or disable http2 in the directadmin.conf
The line say sit all. Either disable mpm_prefork or just disable http2 in the directadmin.conf and this message will be gone. However, it's just a warning, it's not an error.
If you want to use http2 then use php-fpm mode if I'm not mistaken.
 
Back
Top