How to Create a Linux Web Server

Save

In order to create a web server on Linux, the server should be very stable. If the system is like most other commercial Linux systems, it probably runs the Apache web server software. At the moment there are a number of Linux distributions out there, and it is a good idea for you to install and configure your web server using Apache as it is usually the de facto choice for most vendors worldwide. In order to use the Apache web server for creating a Linux-based web server, the following instructions can prove helpful.

Things You'll Need

  • Apache web server
  • MySQL database

Instructions

  • Buy or download an Enterprise edition of your desired Linux distribution. Usually vendors sell pre-configured systems with Red Hat Linux, Ubuntu, etc.

  • The Linux server software installation comes next. While installing the Linux server edition, select the LAMP package.

  • Linux installations usually include the Apache web server as well as other Linux web server packages. Choose the Apache package to install.

  • Once the Apache installation file is downloaded, browse to your download directory and paste the following two lines of code:

    gzip -d httpd-#.tar.gz
    tar xvf http-#.tar

    Here, “#” represents the version of Apache you downloaded. Once you do that, it will create a directory for Apache, which contains all the installations files. Browse to the directory and use the following commands, which will configure Apache and install it:

    ./configure
    make
    make install

    The first command "./configure" will configure your Apache server, the "make" command compiles the files for installation, and the "make install" command installs those files at their proper locations.

  • Your Linux distro may have both MySQL and PostgreSQL. You may install both of them if you like, although the more popular choice is MySQL. Some web applications do however work with PostgreSQL; therefore, it's ultimately your choice. This is basically where you add a database to your web server.

  • Your web application will have to communicate with your web server through a programming language, such as PHP. Linux supports PHP, CGI, Perl and Python. Most people use PHP for web applications.

  • Once you have installed all the primary applications, reboot your server. After rebooting the server, ensure that each necessary application to be run using the root account and the user account itself are working properly.

  • The command "/abc/bin/apachectl -k start" starts your server where “abc” represents the directory where your files are present. If you wish to find those files, type "find /-name apachectl." Entering "/abc/bin/apachectl -k graceful -stop" will stop the server. If you do any configuration changes, you will have to restart your Apache server in order to have them take effect.

  • Once all the primary applications are installed, check if your web server is functioning as it should without any errors. If you're testing this setup on a local machine, simply typing "http://localhost" will tell you if everything is working as planned. If everything is indeed OK, a test page will appear on your web browser. If you'd like to test it from another computer, you will have to use the server's IP address to connect to it. If things are good, you should see a page containing the Apache logo and some text to the effect that the server is running correctly.

References

Promoted By Zergnet

Comments

You May Also Like

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

M
Is DIY in your DNA? Become part of our maker community.
Submit Your Work!