Results 1 to 3 of 3

Thread: How to setup an HTTP web server on a VPS running Debian

  1. #1
    MALIK R1ZWAN's Avatar
    MALIK R1ZWAN is offline Advance Member+
    Last Online
    5th December 2020 @ 03:07 PM
    Join Date
    28 Dec 2015
    Location
    Earth
    Age
    23
    Gender
    Male
    Posts
    885
    Threads
    50
    Credits
    8,579
    Thanked
    115

    Default How to setup an HTTP web server on a VPS running Debian

    Hi, this is my first tutorial on setting up a Web server on Debian. I think it will be useful for someone because the free VPS you got runs Debian. With 128MB RAM, I think it would be better if you install Nginx for webserver, PHP for generating dynamic page and MySQL for database management. I choose Nginx because it is lighter and have better performance than Apache.

    This tutorial explains how to install and configure Nginx

    1. Install Nginx
    PHP Code:
    sudo apt-get install nginx
    sudo service nginx start 
    Now if you point your browser to your IP address, it should confirm that nginx was successfully installed on your VPS.

    2. Configure Nginx
    With virtual host, you can host many site on 1 VPS. Here is how to configure it.
    Open the default virtual host to edit. You can use many free tool to edit text in linux such as vi/vim/emacs... With the limited resource VPS, I recommend "nano".
    PHP Code:
    sudo nano /etc/nginx/sites-available/default 
    In this configuration file, you can config many virtual hosts as you want. A correct configured virtual host look like this:
    PHP Code:
        location / {
                    
    try_files $uri $uri/ /index.html;
            }

            
    error_page 404 /404.html;

            
    error_page 500 502 503 504 /50x.html;
            
    location = /50x.html {
                  
    root /usr/share/nginx/www;
            } 
    Now you can save and exit nano by press Ctr + X, it will ask you to save the edited file, save it.

    Restart Nginx by:
    PHP Code:
    sudo service nginx restart 
    and now you can browse to your web server using your domain name!

    3, Install PHP
    After installing Nginx as the post above, if you want to create dynamic web with VPS, here is the tutorial to help you install PHP.

    Initial installation is simple with the apt-get command.

    PHP Code:
    sudo apt-get install php5-fpm 
    And configure php to work with Nginx. Open
    PHP Code:
    sudo nano /etc/php5/fpm/pool.d/www.conf 
    Find the line:
    PHP Code:
    Find the linelisten 127.0.0.1:9000 
    change it to:
    PHP Code:
    listen = /var/run/php5-fpm.sock 
    Save and Exit.
    Change configuration of Nginx. Add these following lines to each virtual host
    PHP Code:
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
            
    location ~ \.php$ {
                    
    try_files $uri =404;
                    
    fastcgi_pass unix:/var/run/php5-fpm.sock;
                    
    fastcgi_index index.php;
                    
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    include 
    fastcgi_params;
                    
            } 
    Restart php-fpm:
    PHP Code:
    sudo service php5-fpm restart 
    You are done!. You can test your PHP by creating a simple file like this
    PHP Code:
    <?php
    phpinfo
    ();
    ?>
    in
    PHP Code:
    /usr/share/nginx/www/info.php 
    Thanks
    Rizwan


    Punjabi Tigers Rock's

  2. #2
    MALIK R1ZWAN's Avatar
    MALIK R1ZWAN is offline Advance Member+
    Last Online
    5th December 2020 @ 03:07 PM
    Join Date
    28 Dec 2015
    Location
    Earth
    Age
    23
    Gender
    Male
    Posts
    885
    Threads
    50
    Credits
    8,579
    Thanked
    115

    Default

    Quote DJ FUC said: View Post
    Hey you! Advertising your forum is not allowed here.

  3. #3
    MALIK R1ZWAN's Avatar
    MALIK R1ZWAN is offline Advance Member+
    Last Online
    5th December 2020 @ 03:07 PM
    Join Date
    28 Dec 2015
    Location
    Earth
    Age
    23
    Gender
    Male
    Posts
    885
    Threads
    50
    Credits
    8,579
    Thanked
    115

    Default

    We dont need

Similar Threads

  1. http file shearing server with templete
    By nasir_gopang in forum Computer Networking
    Replies: 1
    Last Post: 6th May 2016, 10:38 PM
  2. How To Install Webmin On Ubuntu + Setup Samba Server
    By axe_of_qambrani in forum Videos
    Replies: 2
    Last Post: 30th June 2012, 10:42 AM
  3. Running a web server
    By decent_soldiers in forum Ask an Expert
    Replies: 5
    Last Post: 2nd February 2011, 09:18 PM
  4. opera mini kay Custom http server
    By Moaaz Hameed in forum Mobile phones problems and Help Zone
    Replies: 3
    Last Post: 30th November 2010, 11:35 PM
  5. ISA SERVER 2000 SP2 hotmail http\\502 error
    By AKHTER KHAN in forum Ask an Expert
    Replies: 1
    Last Post: 5th October 2009, 01:36 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •