Archive

Archive for the ‘Apache , htaccess and Front Page’ Category

Error in Drewam Weaver “Cant determine Server Date and time

October 6th, 2009

clients may have experienced the following when using Dreamweaver to connect to a Serv_U FTP server

“Dreamweaver cannot determine the remote servers date and time. The sychronize feature is not available”
[/color]

First lets answer WHY it is happening. This can be explained by 2 reasons:

1. There is a bug in Serv_U FTP 4 server that will convert all uploaded files and folders to lowercase whether you want them to be or not. Not your fault, it just happens.

2. When DW connects to the FTP server it creates a folder called XYIZNWSK gets the Date and time then removes it. You can see this in your FTP Logs as MKD XYIZNWSK and RMD XYIZNWSK. Notice the CAPS?

So here is the problem. DW attempts to write the folder in CAPS, Serv_U converts it to lowercase, DW attempts to read the Date time from a folder the file system on the remote server which doesn’t exist. If you look on the remote view in DW you will see the XYIZNWSK in lowercase. When you click on it to view or remove the folder you get an error saying no such folder exists. Confused? Well thats about as difficult as it gets.

Now lets look at how we can fix it.

This turned out to be quite simple.

1. Go to your DWMX installation folder. (eg. C:\program files\Macromedia\Dreamweaver MX\) and backup your dreamweaver.exe file.

2. Now open the dreamweaver.exe file in a HEX editor such as the one here http://www.hhdsoftware.com/ and search for XYIZNWSK.

3. Once you have located the UPPERCASE XYIZNWSK just replace it with a lowercase xyiznwsk by carefully typing it in and SAVE the file.

4. Open DW and connect to your remote server and you are back in business.

If you have any probs just copy your backup of the dreamweaver.exe file back to the directory and all is sweet. Dont be too shy about making the changes. It isn’t that difficult if you are careful and we have every faith in you.

Apache , htaccess and Front Page

Redirecting domain.com to www.domain.com

October 6th, 2009

Below i am giving the steps to redirect domain name to www.domain.com name
For example :-

If we want to redirect http://goodsignals.com to http://www.goodsignals.com then

1. create the .htaccess file under his public_html folder and write the below lines.
======================================================
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^goodsignals.com [nc,or]
rewriterule ^(.*)$ http://www.goodsignals.com/ [r=301,nc]
======================================================
If you want to redirect any subdomain to his main domain then add only one line in the above .
======================================================
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^goodsignals.com [nc,or]
rewritecond %{http_host} ^123.goodsignals.com [nc]
rewriterule ^(.*)$ http://www.goodsignals.com/ [r=301,nc]
======================================================
Like this you can do redirection for all his subdomain. Just you have to set the condition as above.
This Reirection can’t be done by Cpanel . So i am posting this matter. It is very useful, Because some client ask about it.

Apache , htaccess and Front Page

htaccess redirect and wild cards

October 6th, 2009

When any customers want to use wild cards for redirection such as subdomains or sub folders.

For example: If customers want to redirect the folder and its sub files or folders of their account to main page or other urls such as :
httpd://domainname.com/folder/* to main index.php or any other link, then
you can do that by using the following code in .htaccess.
=================================
Options +FollowSymLinks
Options +SymlinksIfOwnerMatch

RewriteEngine On
RewriteBase /
RewriteRule ^folder/(.*) /index.php
==================================
If you want to redirect to any other link then replace /index.php with the url you want use for redirection.

Now check the links :
httpd://domainname.com/folder/
httpd://domainname.com/folder/123
httpd://domainname.com/folder/wwe/323/ewe

All are redirected to the page given in redirection.

Apache , htaccess and Front Page

Usefull command for checking if a server is under DDOS

October 6th, 2009

netstat -anp |grep ‘tcp\|udp’ | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n

That will list the IPs taking the most amount of connections to a server. It is important to remember that the ddos is becoming more sophistcated and they are using fewer connections with more attacking ips. If this is the case you will still get low number of connections even while you are under a DDOS.

Apache , htaccess and Front Page

Mod Security Log for a single Virtual Host

October 6th, 2009

In most of the servers we see no log being recorded in the audit_log under apache logs folder, this is because of we specifically mentioning to log only the relevant entries of mod security. If any client complains about any 400 series errors related to mod_security, just enable mod-security logging only for that domain in his virtual host entry like

<IfModule mod_security.c>
SecAuditEngine On
CustomLog /usr/local/apache/logs/domain.com_custom_log \
“%h %l %u %t \”%r\” %>s %b %{mod_security-message}i” \
env=mod_security-relevant
</IfModule>

The above entry will log all the requests made for that host so that we can check what rule is causing the problem for that domain and take necessary action, we can specify any rules we want to implement for that virtual host exclusively within the If Module block.

Apache , htaccess and Front Page

up2date issue

October 6th, 2009

If you are getting up2date error while doing anything in the server, it means the server needs to get registered with the Red Hat and you can do it from the server using the following command

rpm -Uvh –force http://rhn.ev1servers.net/pub/rhn-org-trusted-ssl-cert-1.0-3.noarch.rpm

=====

The above command is only part of a script, please follow the complete procedure given below to register the server with the RHN

root@svr64 [~]# up2date -l

Error Message:
Please run rhn_register (or up2date –register on Red Hat Enterprise
Linux 3 or later)
as root on this client
Error Class Code: 9
Error Class Info: Invalid System Credentials.
Explanation:
An error has occurred while processing your request. If this problem
persists please enter a bug report at bugzilla.redhat.com.
If you choose to submit the bug report, please be sure to include
details of what you were trying to do when this error occurred and
details on how to reproduce this problem.

root@svr64 [~]# rpm -q redhat-release
redhat-release-3ES-1
root@svr64 [~]# wget
http://rhn.ev1servers.net/pub/bootstrap/bootstrap.sh
root@svr64 [~]# sh bootstrap.sh
Ev1servers.net RHN registration v1.5
Retrieving
http://rhn.ev1servers.net/pub/rhn-org-trusted-ssl-cert-1.0-3.noarch.rpm
Preparing… ###########################################
[100%]
1:rhn-org-trusted-ssl-cer###########################################
[100%]
+++ fetching client_config_update.py
+++ fetching client-config-overrides.txt
+++ merging client-config-overrides.txt into /etc/sysconfig/rhn/up2date
+++ Registering please wait ….
+++ Registration should be complete!
root@svr64 [~]# up2date -l

Apache , htaccess and Front Page

Apache: [notice] child pid 13628 exit signal File size limit

October 6th, 2009

If you see the following in your apache error log that is in /usr/local/apache/logs/error_log or in /etc/httpd/logs/error_log, you have a problem.
===============================
[notice] child pid 13628 exit signal File size limit exceeded (25)
[notice] child pid 13629 exit signal File size limit exceeded (25)
[notice] child pid 13631 exit signal File size limit exceeded (25)
[notice] child pid 13632 exit signal File size limit exceeded (25)
===============================

Cause:-
======
Apache seems to croak on files larger than 2GB. To determine which file(s) are causing the issue, try the following command:
======================
find / -size +1000000000c
======================
This command will almost certainly take quite some time and will cause significant load on the system. I’d suggest changing the search path (”/”) to the directory your apache/logs(that is /usr/local/apache/domlogs) exist. This will show some file like the following:-
=====================
/usr/local/apache/domlogs/notnhac.com
=====================

Solution(1 or 2):-
========
1.Ultimately the issue is resolved by killing the file. Then you need to again create the blank file with that same name. However, it would be wise to take notice of the effective permissions and ownership before removing the file. Alternatively, you could run a command such as the following which will keep the the permissions intact:
====================
# > /usr/local/apache/domlogs/foo.com
====================
2. Or Just go to the directory /usr/local/apache/domlogs and run the following command:-
====================
echo “” > notnhac.com
====================

Please prefer the second method because it is easy and it won’t effect the permission as well as ownership of the file.

This will resolve the issue.

Apache , htaccess and Front Page

Frontpage not working for addon domains

October 6th, 2009

Problem:

Recently one of our client has as an issue that he cannot access the Addon domain folders using the Frontpage though he was able to login to the main account after changing the main account password. When he clicks on the Addon domain folder it is asking again for the login and then not taking the new password.

Reason:

The problem why it is not taking the new password is when the frontpage extensions are previously installed, they were installed by taking the password of existing cpanel password. But after the changing the cpanel pasword again it seems to be not updated for the addon domains due to which it is asking for the login when accessing the Addon folders via frontpage.

Solution:

Just uninstall the frontpage extensions of the addon domains and clean the old extensions and reinstall them.

Result:

Now you can access the addon domain folders also without asking the login again Smile

Apache , htaccess and Front Page

Setting up Entropy Banner

October 6th, 2009

The Entropy Banner script allows you to create a set of revolving banner images, normally used for advertising. You can upload and delete files, set priority on the images, and set URLs to which each image points.

To set up an Entropy Banner:

1. Click on the Entropy Banner link in the CGI Center area.
2. Copy and paste the indicated tag into your web page.
3. Change your web page extension from .htm or .html to .shtml. This is the required file extension to use SSI (Server Side Includes).
4. Click on the Add Banner(s) button.
5. Search for and enter each banner that you want to upload in the available fields using the Browse… buttons.
6. Click on the Overwrite existing files tick box if you want to overwrite existing files of the same name.
7. Click on the Upload button.
8. If you need to alter the URLs or priority of the images, go to the next step. Otherwise, upload the web page and test the script.
9. Click on the Modify Rotation button.
10. Click on the High, Medium, or Low radio buttons for any banner that you need to change, and click on the Save button. You need to do this for each banner that you need to alter.
11. Enter the URL for each banner image in the Linked to field, and click on the Save button. You need to do this for each banner.
12. You are now finished. Upload the web page and test the script.

Apache , htaccess and Front Page

Apache failing: No space left on device

October 6th, 2009

When you are unable to restart the apache and if you see Apache error log as given below:
——————————
critical_create(): semget() failed: No space left on device
critical_create(): semget() failed: No space left on device
critical_create(): semget() failed: No space left on device
critical_create(): semget() failed: No space left on device
———————————
But It is not DISK trouble. Disk have a lot of space. Probably the problem seems to be of shared memory which means that semaphores are full. You can try deleting the semaphores in the server with ipcs and ipcrm without rebooting the system.

Just run any one of the following command in shell :
————————————————————————————————
for i in `ipcs -s |grep nobody|awk ‘{print $2}’`; do ipcrm -s $i; done

(or)

ipcs | awk ‘/^0×000000/ && /nobody/ {print $2}’ | xargs -n1 ipcrm -s
————————————————————————————————-
The above command is a workaround to clear your shared memory without rebooting. ipcs shows the share memory segments, Semaphore Arrays and message queues. This command clear this using the “semid”s used by nobody (apache).
————————————————————————————————–
then restart the apache now

or

=================
critical_create(): semget() failed: No space left on device
=================

Then we need to run the following script first when we get the above error.

“/scripts/biglogcheck”

after that we can run the either of the commands:
for i in `ipcs -s |grep nobody|awk ‘{print $2}’`; do ipcrm -s $i; done
(or)
ipcs | awk ‘/^0×000000/ && /nobody/ {print $2}’ | xargs -n1 ipcrm -s

then restart the apache now

/scripts/restartsrv httpd


Apache , htaccess and Front Page