Wednesday, June 29, 2011

Enable htaccess on ubuntu

Found the solution!! Apache2 in general, or it might be specifically to Ubuntu, is configured slightly differently than Apache1.x.. at least from what I've seen in the default installs in RH, FC, Mandrake, etc (I'm not Linux or Apache expert).

I went to /etc/apache2/sites-available and edited the file default
There you'll find:

Code:
NameVirtualHost *

ServerAdmin admin@site.com

DocumentRoot /var/www/

Options FollowSymLinks
AllowOverride None


Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
# Commented out for Ubuntu
#RedirectMatch ^/$ /apache2-default/
Default for AllowOverride is none, should be all
/etc/init.d/apache2 restart to restart apache and your .htaccess files should now work!! How frustrating, but educational

Credit to Ubuntu forum

Monday, June 20, 2011

Freebsd apache rotation log / change directory

Freebsd apache rotation log / change directory

add this line at ee /etc/newsyslog.conf

# Rotating Apache log ~ Dipetik dari : http://mikkel.hoegh.org/blog/2009/oct/8/rotating-apache-httpd-logfiles-freebsd

#/var/log/httpd-access.log www:www 440 9 * $W1D4 J /var/run/httpd.pid 30
/data/log/httpd-access.log www:www 440 9 * $D11 J /var/run/httpd.pid 30
/var/log/httpd-error.log www:www 440 9 * $W1D4 J /var/run/httpd.pid 30


after adding at httpd.conf

search http-access.log

CustomLog "/data/log/httpd-access.log" combined


and adding / replace at vhost.conf (if you using vhost)

CustomLog "/data/log/httpd-access.log" common

Restart Apache

Wednesday, June 15, 2011

error : (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80

(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80

I would like to state first of all I am a novice with Linux, but have working in IT for 15 years. I have been searching the web on this issue for almost 2 days (off and on), and have found that my particular issue was not the same as the norm for this particular error code. I would like to give back (if you will).

Apparently having a cert.key password protected will hang Apache2 (maybe Apache as well). The solution was to remove the password on the cert.key and that solved my problem.

The general consensus with resolving this issue did help me figure out that apache2 was running but waiting for password on boot-up. The following command which you will find everywhere out in the cloud is as follows:

sudo netstat -ltnp | grep ':80' (it is important to note that apache was hanging and it did not matter what port I decided to investigate)

This would return the following:
tcp6 0 0 :::80 :::* LISTEN 1047/apache2

Then I ran the following command:

sudo kill -9 1047 (the pid that appears on your particular instance)

I was able to restart Apache and everything was groovy until I rebooted.

I suspected the password and started researching the how to remove the passphrase off of the cert key and found the following article:

http://www.mnxsolutions.com/apache/r...n-ssl-key.html

The following part of the page actually helped me:

Always backup the original key first (just in case)!

# cp www.key www.key.origThen unencrypt the key with openssl. You’ll need the passphrase for the decryption process:

# openssl rsa -in www.key -out new.keyNow copy the new.key to the www.key file and you’re done. Next time you restart the web server, it should not prompt you for the passphrase.

I hope this helps and saves someone some valuable time.
credit to : hhabashy & http://ubuntuforums.org/showthread.php?t=1636667
Reply With Quote

Sunday, June 12, 2011

Change mysql directory on ubuntu 10.04

First you need to Stop MySQL using the following command

sudo /etc/init.d/mysql stop

Now Copy the existing data directory (default located in /var/lib/mysql) using the following command

sudo cp -R -p /var/lib/mysql /path/to/new/datadir

All you need are the data files, so delete the others with the command

sudo rm /path/to/new/datadir

Note:- You will get a message about not being able to delete some directories, but that’s what you want.

Now edit the MySQL configuration file with the following command

gksu gedit /etc/mysql/my.cnf

Look for the entry for “datadir”, and change the path (which should be “/var/lib/mysql”) to the new data directory.

Important Note:-From Ubuntu 7.10 (Gutsy Gibbon) forward, Ubuntu uses some security software called AppArmor that specifies the areas of your filesystem applications are allowed to access. Unless you modify the AppArmor profile for MySQL, you’ll never be able to restart MySQL with the new datadir location.

In the terminal, enter the command

sudo gedit /etc/apparmor.d/usr.sbin.mysqld

Copy the lines beginning with “/var/lib/mysql”, comment out the originals with hash marks (“#”), and paste the lines below the originals.

Now change “/var/lib/mysql” in the two new lines with “/path/to/new/datadir”. Save and close the file.

Restart the AppArmor profiles with the command

sudo /etc/init.d/apparmor reload

Restart MySQL with the command

sudo /etc/init.d/mysql restart

Now MySQL should start with no errors, and your data will be stored in the new data directory location.

credit to : http://www.ubuntugeek.com/how-to-change-the-mysql-data-default-directory.html