Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[GUIDE] Setting Up A Safe Webserver

Status
Not open for further replies.
Banned
Banned
Joined
Apr 29, 2008
Messages
713
Reaction score
264
Okay, since most of you been using the famous "Xampp" to host your web content for your servers. I figured I would lend out a helping hand once again. And help you setup a fast, free, and secure web server. Lets face it 90% of intrusions are done through the web server. Lets get started.

Requirements

NGINX =
Stable Versions (Current : 1.0.5)
PHP =
VC6 x86 Non Thread Safe (ZIP)

Install

  • Open your "My Computer" and navigate to your "C:" drive. When there create two folders named nginx and php.
  • Open up your downloaded version of nginx and extract it to your "C:\nginx" directory.
    Warmonger - [GUIDE] Setting Up A Safe Webserver - RaGEZONE Forums

  • And then do the same for php.
    Warmonger - [GUIDE] Setting Up A Safe Webserver - RaGEZONE Forums


Setting Up PHP

Now our server files are installed we need to set them up. First navigate to "C:\php" and rename php.ini-recommended to php.ini.

Open php.ini in notepad and press CTRL + F and enter extension=php_bz2 into the search box, then hit Find Next and Cancel.
Warmonger - [GUIDE] Setting Up A Safe Webserver - RaGEZONE Forums


And enable the following extensions:

  • php_bz2 (this is useful for large math [which is useful when dealing with item serials!])
  • php_gd2 (for image generation, i.e. CAPTCHA images or signature generation scripts)
  • php_openssl (for TLS support - so you can connect to secure sites like PayPal)

is a full list of php extensions, only enable what you need! If you need for some reason (forums) then enable php_mysql. Forum software will most likely tell you what needs to be enabled in order for them to run properly (wont go into detail). I suggest using as its the safest free forum software on the web.

Now were back to searching, press CTRL + F and enter allow_url_fopen into the search box. Make sure it reads allow_url_fopen = Off. This will prevent code from using fopen() to download remote files (i.e. PHP scripts) and locally executing them to compromise your system.

Now search yet again for extension_dir = "./" and make it read extension_dir = C:\php\ext

You can now save php.ini and close.

Setting Up Nginx

Open up "C:\nginx\conf\nginx.conf" in Notepad.

Hit CTRL + F and search for location / { it will look like this.
Code:
        location / {
            root   html;
            index  index.html index.htm;
        }
Change the root so it says C:/nginx/html, and add index.php under index like so.
Code:
        location / {
            root   C:/nginx/html;
            index  index.php index.html index.htm;
        }

Then, Hit CTRL + F and search for error_page 500 502 503 504 /50x.html; it will look like this.
Code:
error_page   500 502 503 504  /50x.html;
Add in error codes 404 and 403 to the list like so. DO NOT DELETE C:\nginx\html\50x.html EVER!
Code:
error_page   500 502 503 504 404 403  /50x.html;

Next, Hit CTRL + F and search for location ~ \.php$ { it will look like this.
Code:
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}
Un-comment it all and change the fastcgi_param so it looks like this.
Code:
        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }

Save and close nginx.conf.


Running The Server

Download the Control.zip attached below, And extract it "C:\". Double click Start.bat to start the web server , or double click Stop.bat to stop the web server.

Note: The server isn't running as a service so every time your machine reboots, you will have to launch the web server. I will make a tool to install it all as a service shortly and update this post.

Your documents root will be at "C:\nginx\html\", this is where all your website scripts & files will go. To test your nginx & php installation open notepad and paste in this.
PHP:
<?php
phpinfo()
?>
Save as index.php and place it into your document root "C:\nginx\html" (make sure you delete index.html or rename it).

If you navigate to your website (localhost) and all goes well you should see your PHP info.

If you have a missing MSVCR71.DLL error you can download the library here.
Code:
http://www.dll-files.com/dllindex/dll-files.shtml?msvcr71
Just extract to your "C:\WINDOWS\system32" directory.

Have fun.
 
Last edited by a moderator:
Newbie Spellweaver
Joined
Aug 25, 2011
Messages
12
Reaction score
1
Re: [Guide] Setting Up A Safe Webserver

Hi for some reason I keep getting an error "Windows cannot find 'nginx'. Make sure you typed the name correctly, and then try again. to search for a file, click the start button, and then click search." I was wondering if you could tell me if I was doing something wrong. Thanks
 
Newbie Spellweaver
Joined
Sep 4, 2011
Messages
46
Reaction score
0
Re: [Guide] Setting Up A Safe Webserver

well, in general, nobody set ups a webserver at home >.>.

using ftp quite secure, but if you put it on a windows server, just use the IIS that its usualy provided with it.
 
Banned
Banned
Joined
Apr 29, 2008
Messages
713
Reaction score
264
Re: [Guide] Setting Up A Safe Webserver

well, in general, nobody set ups a webserver at home >.>.

using ftp quite secure, but if you put it on a windows server, just use the IIS that its usualy provided with it.

IIS is good if you like a slow, memory hog. :wink:
 
Status
Not open for further replies.
Back
Top