Category Archives: Apache
How to move a cPanel subdomain Document Root to a new location
If you have a customer that setup a subdomain and they used the default location (/public_html/subdomain/), but they have decided that they want to move that outside of the public_html folder, you need to do the following. Open /var/cpanel/userdata/$USERNAME/$SUB.DOMAIN.COM in your favorite text editor Change the path on the “documentroot” line to the path …
Apache Handlers
Apache handlers allow you to control how Apache manages certain files. If you want Apache to handle application/x-hdf hdf application/vnd.wap.wbxml wbxml image/x-xbitmap xbm image/x-icon ico image/vnd.djvu djvu djv application/x-troff-me me application/perl pl plx ppl perl pm application/x-tcl tcl image/bmp bmp text/x-sql sql image/png png text/x-log log audio/x-realaudio ra application/x-latex latex application/x-director dcr dir dxr …
cPanel/WHM logs and locations
Many times you will run across an issue and are unsure what is happening/happened. cPanel has many logs available to the user, but it’s finding the location of these logs that is important. In this post, we will be talking about cPanel logs, and what is in the logs. You can always use the grep …
Limit access to website based on referrer
We use suphp on this server and here was the solution. In the user’s public_html file we created a .htaccess with the following: SetEnv PHPRC /home/$user/public_html/php.ini Then a php.ini file with: auto_prepend_file = /home/$user/public_html/checkrefer.php checkrefer.php <?php session_start(); echo $_SESSION[‘allowme’]; //First we check to see if a valid session exists if ($_SESSION[‘allowme’]==1){ //keep going and allow …
Disable Trace method – PCI
For PCI compliance it’s often required that you disable the trace method. This can be done by adding the following to your apache config or httpd.conf file: TraceEnable off In cpanel we typically add this entry in the following file: /usr/local/apache/conf/includes/pre_main_global.conf Then restart apache: /etc/init.d/httpd restart Then you can test it: telnet 127.0.0.1 80 Trying …
httpd fullstatus
Here’s a quick apache command that will help you with tracking down apache processes and usage: httpd fullstatus
Mod Security Whitelist IP
Sometimes it’s necessary to whitelist an IP address so it can get past the mod_security filters. This is a great feature in case you want to open the filters for one visitor while leaving the security features in place. Open the mod_security whitelist file: vi /usr/local/apache/conf/modsec2/whitelist.conf Code: SecRule REMOTE_ADDR “^111.222.333.444” phase:1,nolog,allow,ctl:ruleEngine=off Where 111.222.333.444 would be …
Disable mod security
It’s easy to disable mod security, however the fix varies depending upon the version of mod_security and the way that it has been installed. For mod_security 1.X try the following in a .htaccess within the user’s home folder: SecFilterEngine Off If that causes a site error or it doesn’t work you’re most likely using mod …
critical_create No space left on device
Recently we attempted to restart apache on a client’s server and we received the following error: critical_create(): semget() failed: No space left on device Although the error hinted at a disk space issue it actually had nothing to do with the available disk space. To resolve this you have two options: 1.) You could reboot …
Disable directory indexing
The easiest way to disable directory indexing is to update/create a .htaccess. Add the following to a .htaccess file within your primary web folder: Options -Indexes
- English Support
- 24/7 x 365
- Branded Support
- Reduced Overhead
- Linux Experts
- Friendly Staff