Categories
Linux Ubuntu 🏴‍☠️

When restart apache server following error : Could not reliably determine the server’s fully qualified domain name

When I restart my apache server using the command

sudo /etc/init.d/apache2 restart

I get the following error:

Restarting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2:
Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

ubuntu 13.10 or newer

As of Apache 2.4 – which is available by default as of 13.10 – you cannot use the method about adding a config file in the conf.d directory.

Apache no longer uses the conf.d directory. All the configuration files are stored inside /etc/apache2/conf-available directory and all the configuration files should now have a .confextension.

In order to solve this message in Apache 2.4, we have to create a configuration file inside the conf-available directory. For example servername.conf.

sudo vi /etc/apache2/conf-available/servername.conf

And inside this we just need to add one line

ServerName localhost

You can combine the previous two commands in one with:

echo "ServerName localhost" | sudo tee /etc/apache2/conf-available/servername.conf

If you want to use a domain name or any other name depending on the requirement its fine, just replace localhost with whatever you need. Next you have to enable this configuration. For this, you need to run the following command:

sudo a2enconf servername

a2enconf is a command to enable a configuration file in Apaches 2.4. Also note that servernameon the above command is from the name of the configuration file servername.conf. If your configuration file was ngenericserver.conf then you would have to write sudo a2enconf ngenericserver.

After this reload the server and the above message will no longer bug you.

sudo service apache2 reload

or

sudo apache2ctl graceful

Now after this you will see that the message will not be shown again and the problem will be fixed.


source : http://askubuntu.com/questions/256013/could-not-reliably-determine-the-servers-fully-qualified-domain-name
Categories
digital ocean Linux MySQL Ubuntu 🏴‍☠️

เมื่อ Mysql Restart ไม่ได้ บน Digital Ocean

Swap Memory

The tiny droplet I have has 512MB RAM, and 20GB on SSD harddisk.
It’s a waste not to create swap memory out of the 20GB SSD!
So, add a few GB of swap memory to your Ubuntu.

Steps:

# Confirm you have no swap
sudo swapon -s

# Allocate 1GB (or more if you wish) in /swapfile
sudo fallocate -l 1G /swapfile

# Make it secure
sudo chmod 600 /swapfile
ls -lh /swapfile

# Activate it
sudo mkswap /swapfile
sudo swapon /swapfile

# Confirm again there’s indeed more memory now
free -m
sudo swapon -s

# Configure fstab to use swap when instance restart
sudo nano /etc/fstab

# Add this line to /etc/fstab, save and exit
/swapfile none swap sw 0 0

# Change swappiness to 10, so that swap is used only when 10% RAM is unused
# The default is too high at 60
echo 10 | sudo tee /proc/sys/vm/swappiness
echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf

credit
http://samwize.com/2014/06/10/cannot-restart-mysql-for-digital-ocean-server-low-memory/

https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04