1

I'm creating a webpage in Ubuntu, in which simple files such as .txt can be uploaded. Now, I want to transform my laptop into an Ubuntu web server, through which any other Ubuntu or Windows user can access that specific web page through Ethernet connection.

How can I make my laptop having Ubuntu into such a web server?

How can I access that web page from another Ubuntu or Windows user via Ethernet? What are the necessary configurations or settings required for that?

don.joey
  • 28,662
dhruvil25
  • 11
  • 1
  • 1
  • 2

3 Answers3

3

Installing the apache2 package in Ubuntu is all you need to host files, and most likely the easiest solution since it is available in the repositories and comes with basic configuration.

sudo apt-get install apache2

After installing the package, a directory will be created at /var/www. Now each time someone tries accessing your browser from a browser will be welcomed by the index page of that directory.

By default, it contains an "It Works!" message, and it's located at

/var/www/index.html

If you remove that file, the browser will instead show a listing of files in that folder.

Thus each file you need to let other computers see in your browser should be located inside that directory.

It can be reached by http://_YOUR_LOCAL_IP_ADDRESS_/

Note: By default, and for security reasons, the /var/www directory is not writable for any user. Check this question and answers for more details on that: How to avoid using sudo when working in /var/www?


After installing Apache, you stop or start the service by typing one of the following respectively:

sudo apache2ctl stop
sudo apache2ctl start

Of course, this isn't all you can do with Apache, but as solution for your problem there isn't more that needs be done.

Dan
  • 13,119
  • Thanks Dan for your answer n comment as well !!!! Can you tell me more about a LAMP server and Apache and where exactly they find their uses....and what differentiates them ?? – dhruvil25 Jan 22 '14 at 16:04
  • @dhruvil25 LAMP just means Linux, Apache, Mysql & Php. So it's just apache with some extra stuff. – Dan Jan 22 '14 at 21:35
  • Check this question http://askubuntu.com/questions/92485/what-is-the-ubuntu-servers-relationship-to-lamp – Dan Jan 22 '14 at 21:39
  • Thannks again Dan. I'm going to build a database, too on a ubuntu desktop and I want that accessible from any pc. So I think I'm gonna need PHP and MySQL ???? – dhruvil25 Jan 23 '14 at 19:12
1

You need one web server like tomcat,glassfish or jboss then put your web page in their deploy directory follow the following steps

sudo apt-get install tomcat7
wget http://mirror.atlanticmetro.net/apache/tomcat/tomcat-7/v7.0.29/bin/apache-tomcat-7.0.29.tar.gz
tar xvzf apache-tomcat-7.0.29.tar.gz
sudo mv apache-tomcat-7.0.29  ~/path/to/tomcat
sudo vi ~/.bashrc
export CATALINA_HOME=~/path/to/tomcat
. ~/.bashrc

now go to your web servers bin directory and run the run.sh hile using

$CATALINA_HOME/bin/startup.sh

and before that just make sure that all the environment variable like JAVA_HOME and all that are properly configure and make sure that you and your web server containing device are connected in same lan network

now go to your web browser and type like

http://your_webserver's_ip:8080/your_webpage_name/

i think that's it it will help you.

smn_onrocks
  • 526
  • 5
  • 14
0

Hi & Welcome to the community.

You can achieve this by setting up LAMP server within your Ubuntu distribution. To do this you may follow below official Ubuntu documentation;

I personally like Digital Ocean's article which is quiet interesting & also found one from How To Geek;

Once you've installed the server accordingly, you can access it locally within your PC. If that is all done, next is to check whether others can access it within the LAN/WLAN. Usually if the server is up & running with no errors. You may try accessing the IP of your respective workstation from another

http:// your_pc_ip_address or http:// your_pc_ip_address:80 (or the specified port, default is 80 for HTTP)

I also found below article while searching which may help you.

Hope this helps & make sense for you to achieve what you want.

AzkerM
  • 10,270
  • 6
  • 32
  • 51
  • If a simple webserver is needed to just host static files, there is no need to install LAMP. Both PHP and MySQL would be useless. Apache would be more than sufficient. – Dan Jan 22 '14 at 12:45