Useful Tips And Tricks

Saturday, 9 April 2016

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

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

Hi, this is my first tutorial on setting up a Web server on Debian. I think it will be useful for someone because  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  
Conclusion
 i Dont know it's useful For You Or not
 But It's useful For Someone



Top 10 USB drive / pen drive related problems and fixes

Top 10 USB drive / pen drive related problems and fixes:
How To Fix USB Problems


1... Computer Does Not Detect Pen Drive or USB Drive or i-pod:
This kind of problem is faced due to some bad registry settings. After you fix up the registry, the USB drive will work fine. To fix this issue,see this post.
2... Pen Drive or USB Mass storage device disabled at office or college or school:
At many offices and colleges, the IT people disable or block the use of pen drives. To enable the USB drive when it is blocked, see this post.
3... Problem in removing pen drive:
When you try to remove the pen drive via safely remove hardware option, it gives error “Generic volume can not be stopped right now”. It may damage your pen drive if it is removed without stopping it properly. To fix this error, read this post.
4... Protect computer from virus in pen drive:
Many of the deadly viruses spread easily through use of pen drive. To see the safety tips on how to protect the computer from virus infection by pen drive, see this post.
5... USB drive is detected, but not shown in My Computer:
This kind of problem is also seen in cases of conflict over drive letter assignment by windows. The drive is there and detected but without a valid drive letter assigned to it. See the fix to this problem here.
6... Problem in formatting pen drive:
Sometimes when you try to format the pen drive, you might see an error which says “Can not format the drive”. There can be several reasons for this. To fix this problem, see this post.
7... USB Device has Malfunctioned:
This one of the unusual warnings which you get sometimes, the solutions to this problems sounds silly, but it works, see the solution here.
8... Delayed Write failed error:
This is another kind of error which is more common with USB hard drives due to some error in File allocation table. This problem can be fixed by following few simple steps. See the fix here.
9... Disable data writing on pen drive:
This is one of the articles which tells you how you can stop data writing on your pen drive on a particular computer. This will save the drive from getting virus infections. See the post here.
10... Fixed SATA Drive shown in removable USB drive list:
This problem we have recently seen for many users. This is a kind for feature in a certain RAID configuration, but annoys many users. See the fix for this trouble here.