Unable to install LAMP (Linux, Apache, Mysql, PHP stack) on Ubuntu 16.04


I am trying to install LAMP server on my Ubuntu desktop. The problem I am facing is related to IP address of my laptop.

While Setting Global ServerName to Suppress Syntax Warnings, as the documentation says here, when I am adding a ServerName directive, pointing to my server's public IP address in configuration file, /etc/apache2/apache2.conf.

It says to add the following at the bottom of the config file

ServerName server_domain_or_IP

I added the IP address which the Google page displays (on searching my IP) and typed the URL http://my_IP But the default page was not displayed.

I think the IP which I used is wrong. As I am connected to my home wifi router and all the devices which are connected to the router has the same IP address.

Can anyone tell me how can I solve this problem? Which one is the correct IP to use and how can I find that IP address?

I am using Ubuntu 16.04.

2 Answers: 

The tutorial you are using is from Digital Ocean, where you can spin up virtual servers that have a publicly available IP address. Your computer at home is not publicly available to the Internet. When paying a company such as Digital Ocean, they are going to rent to you an IP address that is unique to the Internet and can be found by any browser in the world.

However, you can run your LAMP stack in your home as a local development server to learn about web development. You will need to give your server a unique address within your network. You can do this through your router, where you log on to your router, find your device and assign it a static IP address, such as You'll have to find the documentation for your router. This doesn't make it public, but rather makes it easy to find on other computers within your home network.

From there, you can get to your development server Apache by typing the IP address directly in your browser, without the http://, simply type and if your LAMP stack is up and running should give you an initial Apache page.

There is a lot to learn, but take it one step at a time and you'll get there.


You are using NAT. The IP address you are using is not your server's public IP address, it is your router's public IP address.

Your server doesn't have a public IP address.

You need to listen on your server's LAN IP address and configure your router to perform port forwarding to your HTTP server on that IP.


More Articles

node.js - Not able to run my node app at port 80 on ubuntu 16.04

I want to run my node app at port 80 in ubuntu 16.04. But the moment I'm trying to run my app with npm start its throwing error Port in already in use whereas it's not in use. According to Github Reply, We need root privileges to run on ports below 1048 which is correct.So the moment I'm trying to r

shell - Move output of Find command unix

Im learning unix programming , i want to find all files whose size is greater than 1M an print them into a file.here is my code find. -size +1M -print0 | xargs -I -O '{}' mv '{}' files all sites i have found refer to this one as right one , but it does not work . currently im working on ubuntu

php - Ubuntu Server Virtual Host not redirecting properly

I have installed Web site on my Ubuntu Server. The following things are installed on my Server for running web service. 1) Apache22) PHP53) MySql My main website is redirected to https.Example (changed for security purpose) <VirtualHost *.80>ServerName www.example.comServerAlias example.co

shell - UNIX: copy entire directory structure and only specific file type

How i can recreate entire directory structure and copy only files with .txt extension if present. I would like to copy the directory or sub-directory even if its empty.

How do I insert PHP variables in a MySQL table?

This question already has an answer here: Reference: What is variable scope, which variables are accessible from where and what are “undefined variable” errors? 3 answers

linux - filter out content between two files

I have two files conditions.txtabcdefghlogs.txtefghijklmnopqrstI am expecting output to be:ijklmnopqrstActual output:efghijklijklmnopmnopqrstqrstHere's the code I had worked till nowfunc(){while read conditiondoif [[ $line = $condition ]] ; then:elseecho "$line";done < condition.txt}while read li

c - Why do I get a seg fault on Ubuntu but not mac?

I have a program that checks the modification time of a file and executes the file if it has changed. Currently it works if I run it on my mac, but it seg faults if I run it on ubuntu. Please help me.note: this is in c#include <unistd.h>#include <stdlib.h>#include <stdio.h>#inclu

php - Page not found error on apache server on ubuntu 14.04

I have a project which i developed using WAMP. The project works fine as expected. I tried to use the same project on LAMP stack (Ubuntu 14.04). I imported the database to mysql server and then copied the files to /var/www/html folder and gave permissions using chmod to all files in www folder. When

linux - Run a intotify sricpt in background

how can i run 12 bash scripts simultaniously in the backgroud?That's the script:#/bin/bashwhile inotifywait -e close_write /var/www/html/wp-content/QM-Handbuch /01-Inhaltsverzeichnis.doc; do soffice --headless --convert-to pdf /var/www/html/wp-content/QM-Handbuch/01-Inhaltsverzeichnis.doc &

mysql - How to install older PHP version in XAMPP on Ubuntu 16.04?

I'm trying to install Magento on my system, But it gives me an error that the PHP version that I have is newer and Magento is not supported that version. So now I'm trying to downgrade my PHP version from XAMPP that I'm installed on Ubuntu 16.04.Error : PHP Version Check Your PHP version is 7.1.1.