I want to install LAMP in Ubuntu. I have installed Apache.
After the command sudo ufw allow in "Apache Full" it shows
"unable to resolve host". How can I solve this?
- 109
2 Answers
To resolvethe host just add it to /etc/hosts, like at the example:
For more details read this answer.
According to the @Rinzwind's comment, I think, port 80/443 must be opened in the Windows firewall. Here is a video instruction about it.
If you have a router and you want your web server to be accessible from outside, don’t forget to add some port forwarding. Something like that:
I will leave here and these few tips about UFW configuration on native Ubuntu:
To allow external access to Apache through UFW, you need to use:
sudo ufw allow http
sudo ufw allow https
To enable tcp protocol only use:
sudo ufw allow http/tcp
sudo ufw allow https/tcp
You can use and the port number directly:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
For some services (like "SSH" or "Webnin", which by default uses web interface at port 10000) you can add little security by using of limit rule instead of allow. This will limit the number of login attempts per certain time for these ports:
sudo ufw limit ssh/tcp
sudo ufw limit 10000/tcp
Just in case you can reload the "rules table":
sudo ufw reload
- 30,621
Get updates
sudo apt-get update
sudo apt-get upgrade
Install LAMP
sudo apt-get install apache2 php5 libapache2-mod-php5 mariadb-server php5-mysql php5-cli php5-gd
Change port
if Windows is using 80 already
vim /etc/apache2/ports.conf
Change 80 to 8080
Start services
sudo service apache2 start
sudo service mysql start
Clean urls
sudo a2enmod rewrite
vim /etc/apache2/apache2.conf
Add:
AllowOverride All
Then:
sudo service apache2 restart
Create database
mysql -uroot -proot -e 'create database your-db-name;
Install Composer
Make it global
sudo mv composer.phar /usr/local/bin/composer

