Internal Error Server 500
On a cPanel server running suPHP getting Internal Server Errors can be caused by file or directory permissions. One of the best ways to diagnose such issues it to look at the suPHP log files and fix any errors that are reported.
tail -f /usr/local/apache/logs/suphp_log
Fixing cPanel file permissions
Just for my own note
After installing suPHP on server, execute :
find /home/*/public_html -type d -exec chmod 755 {} \;
This command fix all folder permission
find /home/*/public_html -name '*.php' -o -name '*.php[345]' -o -name '*.phtml'| xargs chmod -v 644
This command fix all file permission
#!/bin/bash cd /var/cpanel/users for user in * do chown -R $user.$user /home/$user/public_html/* done
This script fix all ownership issue
Get a list of directory sizes in Linux
Getting a list of directories and their sizes in Linux is pretty easy. All you need to do is use the following command:
du -sh /*
Removing siteid and index.cfm from Mura URLs
In this article we will be going through the way to change your Mura CMS URLS from:
http://www.yourdomain.com/default/index.cfm/page/sub-page/
INTO
http://www.yourdomain.com/page/sub-page/
To remove the siteID directory in the URL:
In the local contentRenderer.cfc ([www/[siteID]/includes/contentRenderer.cfc) uncomment the function named getURLStem() or paste the below code at the base of the file:
<!--- This is to used when removing both siteID and index.cfm from urls--->
<cffunction name="getURLStem" access="public" output="false" returntype="string">
<cfargument name="siteID">
<cfargument name="filename">
<cfif arguments.filename neq ''>
<cfreturn "/" & arguments.filename & "/"/>
<cfelse>
<cfreturn "/" />
</cfif>
</cffunction>
Edit www/index.cfm and replace:
<cfinclude template="tasks/content/redirect.cfm">
with
<cfinclude template="tasks/content/contentServerRoot.cfm">
The .htaccess file / code to remove the index.cfm:
RewriteEngine On
# If it's a real path, just serve it
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [L]
# Redirect if no trailing slash
RewriteRule ^(.+[^/])$ $1/ [R=301,L]
# Rewrite Mura CMS URL paths
RewriteRule ^(.*)$ /index.cfm%{REQUEST_URI} [L]
The old /[siteID]/ urls will still work after making these changes.
Recursively change file and directory permissions
I cam across this script o recursively change the file and directory permissions on a linux box.
find -type d -print0 |xargs -0 chmod 755 find -type f -print0 |xargs -0 chmod 644
cPanel missing dedicated IP
Every now and then I get a site on our cPanel servers that stops working. After investigating the issue it turns out to be a missing IP from the cPanel server. Here is the latest remedy I found for this:
/scripts/rebuildhttpdconf service httpd restart service cpanel restart
SNMP on XenServer
To start SNMP on XenServer 4.0.1, 4.1, or 5, use the following command
service snmpd start
This command only starts the SNMP daemon. To have the service start during system start up, please use the “chkconfig” utility.
chkconfig snmpd on
FTP Server in Mac OS X Lion
At first glance it looks like Apple has removed the FTP server support in Lion. But if you dig a little deeper you’ll find that the only thing that has really been removed is the GUI related to the FTP server.
Here’s how you can start the FTP server in Mac OS X Lion:
- Open a terminal window.
- Type in the following command:
- To turn it off, type in the following command:
sudo -s launchctl load -w /System/Library/LaunchDaemons/ftp.plist
sudo -s launchctl unload -w /System/Library/LaunchDaemons/ftp.plist
Clean HTTP Usage in cPanel IP Usage table
Once again this is a place holder for myself as to the steps needed to change a phantom entry in the IP Usage Table in cPanel. We run our cPanel servers on VM within our environment. So we have a cPanel template that is used to spin off new servers as needed. The IP and host name of the newly spun off servers has to be changed and sometimes the old entries get stuck in this table.
cd /var/cpanel/userdata/nobody
“ls” showed the following files:
main main.cache
nano main
/scripts/rebuildhttpdconf
/etc/init.d/httpd restart
Restoring a failed cPanel Apache build
If the Apache rebuilt is successful but httpd cannot be started due to configuration issues the following scripts can help to restore a previous or archived build.
# /scripts/easyapache --restore-archive
Bring up UI to choose available archives and restore them if desired
# /scripts/easyapache --restore-archive=listonly
List available archives only
# /scripts/easyapache --restore-archive=/path/to/easyapache/archive
Attempt to restore this build archive
!! only use if you are 100% sure the path is an easyapache build archive !!
Search
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Feb | ||||||
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | 31 | ||