linux/ubuntu
Apache web server slow to respond, Poor performance Ubuntu Linux
by swicknire on Mar.14, 2009, under linux/ubuntu
If you’re finding that when going to your web page it’s taking a little too long to make the connection, or its just running sluggsih – it may be trying to resolve your ip via a DNS lookup.
There are many performance tweaking options to tune your apache configuration, but I’m going to start by handling just this one.
Now by default HostnameLookups should be Off. And can be found in
/etc/apache2/apache2.conf
HostnameLookups Off
But you may also want to add it to the httpd.conf
/etc/apache2/httpd.conf
And restart apache
sudo /etc/init.d/apache2 restart
This may or may not fix your performance issues, but it sure did help me greatly! (Even though it was set to off in the apache2.conf file, adding it to the httpd.conf file increased my performance)
An interesting article you may find useful HERE
SSH Slow to respond for password input (timeout problems) Ubuntu Linux
by swicknire on Mar.14, 2009, under linux/ubuntu
If you find your SSH client is taking too long to connect (and ask you for the password), or you’re trying to SFTP and it’s timing out before the password prompt. It’s probably trying to do a DNS lookup!
It’s a quick and easy fix! Just edit the following file:
/etc/ssh/sshd_config
And add or change the following:
UseDNS no
Restart SSH
sudo /etc/init.d/ssh restart
SSL Certificates (ssl_error_rx_record_too_long) Ubuntu Linux
by swicknire on Mar.14, 2009, under linux/ubuntu
It seems obvious you’ve come across the following error while trying to setup SSL certificates on apache.
Error code: ssl_error_rx_record_too_long
Well more often than not, you have something mis-configured! (Likely the listening port: 443). What you might want to do is check that your firewall or iptables allows incoming connections on 443.
Ubuntu:
#sudo ufw allow 443
Ok, wonderful – that probably didn’t fix your problem. But now try going to the following address
http://www.domain.tld:443
If you’ve successfully seen something at the above page, it means your sites are listening on that port for non-ssl. I’ll assume that your apache virtual host file has something along the lines of:
NameVirtualHost *
<VirtualHost *>
What you’re going to want to do is force your vhosts to listen specifically on the proper ports. Changing to the following:
NameVirtualHost *:80
<VirtualHost *:80>
If you’re using ubuntu your ports.conf file should likely have 443 enabled on the listening port, and you may also have default-ssl listed in your /etc/apache2/sites-available/ folder. In which case you may want to enable that.
#sudo a2ensite /etc/apache2/sites-available/default-ssl
Basically that file has the following inside of it
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
…… your server name / document root …..
SSLEngine on
SSLCertificateFile /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key</VirtualHost>
</IfModule>
While you can use a single “shared” SSL certificate for multiple hosts, if each host needs it’s own SSL, they will need static ip addresses.
Adding a static route in ubuntu linux
by swicknire on Mar.05, 2009, under linux/ubuntu
You may come across the circumstance where you have one ip subnet with a gateway ip on a different subnet.
Lets say for instance your static ip is 10.10.0.1 and you need to set the gateway as 9.9.0.1. After your initial setup of static ip, you may notice the destination is unreachable.
configure your static ip via command line
sudo nano /etc/netowork/interfaces
if you hapen to be using centos or fedora, you may use something similar to
system-config-network
(or)
setup
in ubuntu using the /etc/network/interfaces file
auto eth0
iface eth0 inet static
address 10.10.0.1
netmask 255.255.255.0
gateway 9.9.0.1
now while all looks right, you probably won’t be able to get online. You can restart your interface with
sudo /etc/init.d/network restart
if you add a custom route to the host and set the default gateway you should then be able to access something
sudo route add -host 9.9.0.1 eth0
sudo route add default gw 9.9.0.1
hopefully everything should be good to go! Make sure that your /etc/resolve.conf file has proper name servers for your isp.
nameserver 123.123.123.123
Now in order to make these changes persistant on startup/reboot you may add them to the /etc/network/interfaces file, but typically that has never worked for me across any distro.
What I do is add them to my rc.local file (which is executed after all other system modules are brought online).
sudo nano /etc/rc.d/rc.local
/sbin/route add -host 9.9.0.1 eth0
/sbin/route add default gw 9.9.0.1
This should help bring your network back online in case of power outage or reboot. Keep in mind that if you /etc/init.d/network restart you will likely have to manually add those routes by hand again. (no biggie).
To check your routing table just simply
route -n
How To Increase PHP Memory Limit
by swicknire on Feb.21, 2009, under linux/ubuntu
Ok, I’m sure that at one point or another we’ve all come across:
Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 1966080 bytes)
Or some similar number of bytes, when trying to execute various web based php scripts or applications. The easiest way to change this is to drop in a .htaccess file with the following line (in your html directory)
php_value memory_limit 32M
If you have access to your php.ini file or wish to make the change that way, just change the following line to whatever Meg of ram you want. (Try 32M)
memory_limit 16M
How To install Zend Ioncube Loader PHP Ubuntu Linux
by swicknire on Feb.20, 2009, under linux/ubuntu
Download the current tarbal for your architecture. (Mine is x86_64) Choose your’s accordingly.
wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
next extract it
tar -zxvf ioncube_loaders_lin_x86-64.tar.gz
move the loader you need or just extract the whole dir to whatever location
sudo mv -R ioncube/ /usr/local/lib/
Edit your php ini file and add the following line:
sudo nano /etc/php5/apache2/php.ini
zend_extension=”/usr/local/lib/ioncube/ioncube_loader_lin_x.x.so”
restart apache
sudo /etc/init.d/apache restart
(or)
sudo apache2ctl restart
Change Computer Name / Host Name Ubuntu Linux (8.10)
by swicknire on Feb.19, 2009, under linux/ubuntu
If you want to change the computer name of your linux box, it’s quite simple. Use the following commands to ensure the name is changed.
sudo nano /etc/hostname
And then make sure your hosts file is updated with the new name as well
sudo nano /etc/hosts
I typically use nano (pico) because to me it seems more user friendly and intutive. You may use vi or any such editor you wish.
How To Connect To a VPN using Ubuntu Linux (8.10)
by swicknire on Feb.19, 2009, under linux/ubuntu
In order to connect to a VPN you need a few things. Firstly you’ll need to install a VPN client. (Openvpn being my choice).
sudo apt-get install network-manager-openvpn
Then on the network icon on your task bar, right click and select “edit connections”.
Clicking on the VPN tab should now show the add/import buttons available. Click either depending on the files you were given by your system administrator (or whomever). Enter all your settings and select all the key locations and click OK when done.
Close the network connections box and then you are able to left click on the network icon on the taskbar, going to “VPN Connections” and selecing the VPN you just created. (A little lock will show up with a swirly thing going around your icon!).
Ubuntu Create an ISO image using the command line.
by swicknire on Oct.08, 2008, under linux/ubuntu
Ubuntu Create an ISO image using the command line.
If you’re like me, you have a server or other system which doesn’t have an X system for various reasons. But you want to use all the hardware and create ISO’s or burn dvd’s from the command line for backups or what have you.
In order to copy a data disk or directory I use the following
dd if=/input/file of=outputfile.iso
Ripping dvd’s
mkisofs -dvd-video -o /home/dir/myiso.iso /media/dvdrom
growisofs -dvd-compat -Z /dev/dvd=myiso.iso
Ubuntu Linux – disable PC speaker beep.
by swicknire on Aug.02, 2008, under linux/ubuntu
Removing the PC Speaker beep on Ubuntu, Debian or other Unix systems.
You can easily blacklist the pc speaker with the following commands.
rmmod pcspkr
open /etc/modprobe.d/blacklist and add the following line
blacklist pcspkr
to re-enable the pc speaker
modprobe pcspkr