(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 | |
Wednesday, June 15, 2011
error : (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
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
Thursday, May 5, 2011
How to block port 80 on ubuntu
iptables -A INPUT -j DROP -p tcp --destination-port 80 -i eth0
The code above will drop all tcp packets coming into your Linux computer on device eth0 on port 80. If your Internet connection runs through a device other than eth0, go ahead and make the adjustment.
To remove the iptables rule use the following code:
iptables -D INPUT -j DROP -p tcp --destination-port 80 -i eth0
credit to : foogazi
Wednesday, May 4, 2011
SSL on Ubuntu
Currently my machine running on Ubuntu 10.10 with Apache2 & Backuppc
Below step by step how to :
Setting up SSL with Ubuntu 8.10 is a simple process but it does have a few gotchas that you need to be aware of. The setup has changed from 8.04. One issue is that the +CompatEnvVars is no longer used as it created a bug in 8.10 and you will have to enable the default-ssl site to get everything working.
First, log on to your server Install Apache:
sudo apt-get install apache2
Change to the /etc/apache2/mods-available directory and look at the available modules. Then change to the /etc/apache2/mods-enabled directory to see what modules are enabled:
cd /etc/apache2/mods-available
ls
cd /etc/apache2/mods-enabled
ls
Now, install and enable SSL:
sudo a2enmod ssl
sudo /etc/init.d/apache2 force-reload
Change to the default webserver directory, and create a simple web page:
cd /var/www
sudo vim index.html
Add the following content:
http://IP_address_of_my_server
You should be able to view your web page. Now, you’ll want to encrypt your site. Create the server encryption keys:
cd /etc/apache2
sudo openssl genrsa -des3 -out server.key 1024
Use this set of keys to create a certificate request:
sudo openssl req -new -key server.key -out server.csr
When asked to input data, use your imagination to create something appropriate. Be sure to write down your passphrase. Use this request to create your self-signed certificate:
sudo openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
Install the key and certificate:
sudo cp server.crt /etc/ssl/certs/
sudo cp server.key /etc/ssl/private/
Open the “defaults” file for editing:
cd /etc/apache2/sites-available
sudo vim default-ssl
This file is basically set up but you will want to uncomment the SSLOptions line and also change the SSLCertificate lines to reflect the location and name of your new information.
SSLEngine on
SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
SSLCertificateFile /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key
The port 443 is enabled when you use SSL so that is ready to go.
Enable the default SSL site:
sudo a2ensite default-ssl
If you do not enable the default-ssl you will get this error:
“ssl_error_rx_record_too_long apache”
Restart Apache.
sudo /etc/init.d/apache2 restart
You now be able to see your web site running on https
Thanks & credit to : http://beginlinux.com/blog/2009/01/ssl-on-ubuntu-810-apache2/ & Mr. Mike
Monday, May 2, 2011
Restore backup mysql to a remote mysql server.
mysql -unameuser -p --default-character-set=utf8 < dbname.sql --host=yourIPmysqlServer
* Please take note you must granted the user before restore the DB.
