EA3 to EA4 - Permanent httpd.conf Changes
These are old threads of mine where I described how i wanted to permanently change the httpd.conf file to add system-wide mime types to make an .aspx file be ran as a php file and also get rid of the mysite.tld/whm and mysite.tld/cpanel shortcuts.
System-Wide Apache Handler and MIME Types
Disable mysite.tld/whm And mysite.tld/cpanel Shortcuts?
I am now migrating to a EA4 server from and EA3 server and I want to know if the process is still the same. What i did before on my EA3 server was this:
- Logged into SSH with root changed dir to /var/cpanel/templates/apache2_4
- cp main.default main.local
- vim main.local and did vim search for 'main.mainifmodulemimemodule.item.ifmodule'
- found it. and edited the block to look like this:
TypesConfig [% main.ifmodulemimemodule.typesconfig.item.typesconfig %]
[% FOREACH dir IN main.ifmodulemimemodule.addtype.items -%]
AddType [% dir.mime %] [% dir.extension %]
[% END -%]
AddType application/x-httpd-php5 .aspx
- vim searched for "main.scriptaliasmatch.items" AND REMOVED THESE 3 LINES from the main.local file:
[% FOREACH dir IN main.scriptaliasmatch.items -%]
ScriptAliasMatch [% dir.regex %] [% dir.path %]
[% END -%]
- saved and quit vim
- ran '/scripts/rebuildhttpdconf' by just typing '/scripts/rebuildhttpdconf' in the commandline. It said '/usr/local/apache/conf/httpd.conf OK'.
- restarted apache using 'service httpd restart'
- ran EasyApache to rebuild Apache/php and the changes to httpd.conf survived! So Success in EA3.
-
Hello, Instructions for using that same method with EasyApache 4 are referenced on this post: Apache log format issue with EasyApache 4 However, generally you should one of the methods documented at: Advanced Apache Configuration - EasyApache 4 - cPanel Documentation For changes within all Virtual Hosts, you'd follow the instructions at: Modify Apache Virtual Hosts with Include Files - EasyApache 4 - cPanel Documentation Thank you. 0 -
Thanks for the links and hints Michael. I ended up adding these lines to the WHM httpd.conf include editor (WHM "Home "Service Configuration "Apache Configuration "Include Editor) in "Pre VirtualHost Include" for "All Versions" and it seemed to do the trick. AddHandler application/x-httpd-ea-php70 .aspx AddType application/x-httpd-ea-php70 .aspx If you can think of a reason this is a bad idea let me know. I also added a .htaccess file with the same commands for backup in case EasyApache messes something up down the line. It's real important my aspx files are processed as php and the code not just served up as text. One concern is if php is upgraded either automatically or i do it myself forgetting that it will break the AddType command then all my code will be served up as text until i fix the AddType command to use the new php handler. 0 -
One concern is if php is upgraded either automatically or i do it myself forgetting that it will break the AddType command then all my code will be served up as text until i fix the AddType command to use the new php handler.
This is the primary concern you will face when adding that custom AddHandler entry. You may want to consider using the following UAPI function via the command line to quickly enable that custom Mime type for all accounts: UAPI Functions - Mime::add_mime - Software Development Kit - cPanel Documentation You could also setup a script that utilizes that UAPI function and then runs it automatically as a hook during account creation. Thank you.0
Please sign in to leave a comment.
Comments
3 comments