How to configure a local test server? Learn web development | MDN, create a house server from a miniPC: the guide

Create a house server from a miniPC: the guide

In MDN courses, most of the time, you are asked to open the examples directly in the browser-you can do it by double clicking the HTML file, depositing it in the window of your browser, or by making File > Open. and navigate to the HTML file, etc. There are a lot of ways to get there.

How to configure a local test server ?

This article explains how to configure a simple local test server on your machine, and the basics to use it.

Prerequisites: You must first know how internet works (EN-US) And what a web server is (EN-US) .
Objective: You will learn to configure a local test server.

Local files against remote files

In MDN courses, most of the time, you are asked to open the examples directly in the browser-you can do it by double clicking the HTML file, depositing it in the window of your browser, or by making File > Open. and navigate to the HTML file, etc. There are a lot of ways to get there.

You know that you have launched the example from a local file, when the URL starts with File: // Followed on the access path in your file system. On the other hand, if you consult one of our examples hosted on GitHub (or any other remote server), the web address will start with http: // or https: //; In this case the file was served via http.

The local test problem

Some examples will not work if you open them as local files. There are several possible reasons, the most common of which are:

  • They are based on asynchronous requests. Some browsers like Chrome do not perform asynchronous queries (see data harvesting from the server) if you simply launch the example as a local file. This is due to safety restrictions (see websites security to find out more).
  • They implement a specific language, turning on the server. Languages ​​on the server side (such as PHP or Python) require a specific environment provided by the server to interpret the code and give results.

Create a simple local HTTP server

To bypass the problem of asynchronous queries, we must test such examples by performing them from a local server. Python’s Simplehttpserver Module allows simple implementation of this solution.

Here is the procedure to follow:

  1. Install python. If you use GNU/Linux or MacOS, a Python environment is probably already available on your machine. Windows users can find an installer from the Python home page (there are all the instructions):
    • Go to Python.org
    • Under downloading, click the link for Python “3.xxx “.
    • At the bottom of the page, download the file pointed out by the link Windows X86 Executable Install.
    • Execute this program when the download is finished.
    • On the first page of the installer, make sure you have checked the box “Add Python 3.xxx to path “.
    • To click Install, Then Close When the installation is complete.
  2. Open your command prompt (windows)/terminal (OS X and Gnulinux). To verify that the previous installation took place properly, enter the following command:

#Incing the name of the file to go there, #For example CD Desk # Use two points to get back in #Parent file if necessary CD .. 
# If the version of Python returned is later at 3.X python3 -M http.server # If the returned Python version is later than 2.X python -M Simplehttpserver 

Note : If Port 8000 is busy, you can choose another port by specifying another value after the order for example Python -M http.Server 7800 (Python 3.x) or Python -M Simplehttpserver 7800 (Python 2.x). You can now access your content at the LocalHost address: 7800 .

Locally operating server languages

Python’s simplehttpserver module is useful, but he does not know how to execute written code in languages ​​like PHP or Python. To manage this, you will need something more – what you will need exactly depends on the server language that you are trying to execute. Here are some examples :

  • To execute Python Coté-Server code, you will need to use a Python web framework. You can find out how to use the Django framework by reading Django Web Framework (Python). Flask is an alternative to Django, a little lighter. To execute it, you will need to install Python/Pip, then Flask using PIP3 Install Flask . At this point, you should be able to execute Python Flask examples using for example Python3 Python-Example.Py, then consult Localhost: 5000 in your browser.
  • To execute node code.JS (JavaScript) On the server side, you will need to use a raw knot or a framework built on the latter. Express is a good choice – See Express Web Framework (node.JS/JavaScript).
  • To execute PHP code on the server side, you will need a server configuration that can interpret PHP. Good options for testing PHP locally are MAMP (Mac and Windows), AMPPS (Mac, Windows, Linux) and Lamp (Linux, Apache, MySQL, and Php/Python/Perl). These are complete packages that create local configurations allowing you to execute a Apache, PHP server and MySQL databases.

Found A Content Problem With This Page?

  • Edit the page on github.
  • Report the content from.
  • View the source on github.

This page was last modified on August 3, 2023 by MDN Contributors.

Create a house server from a miniPC: the guide

Want to create a house server on a miniPC ? Just to accommodate web pages, manage emails, save data, learn these tools and other things ? It is possible and it is easy by following this very detailed guide offered by Magentix.

By Pierre Lecourt on November 12, 2021 12 Comments

Magentix is ​​an independent Magento developer and incidentally a blog reader. He is also someone meticulous and applied and it is for this good reason that his guide to create a house server made me want to make this post.

I will not paraphrase his guide, it would make no sense, so I will send you back to his site which will detail the whole point procedure by point. I just take advantage of this post to recall one of the interests of these particular minimachines which flourish from time to time on the blog. Very low calculation performance devices for the end of 2021. Meager Celeron, Pentium and other sometimes older chips, locked in very compact chassis. Their low performance corresponds to basic uses in terms of miniPC: web, office automation, multimedia uses. But they are also largely sufficient to create a house server. With the big advantage of consuming only a few watts over time and therefore not increasing voting electricity bill.

Minimachines-11-2021

Magentix uses a Mele Quieter 2 for his own server. A machine that has a Celeron J4125 and whose consumption it measures only a few watts. The machine is built to turn 24 hours a day and does not generate any noise since it is completely passive. Cost year -round to have this small server next to its supplier box ? Only two euros.

The guide is very detailed and is based on a Linux Debian distribution while leaving you to choose other solutions. You don’t have to be a sworn expert to create a house server, everything is extremely detailed with several scenarios each time. The only small particular element corresponds to its operator since the machine turns behind a free fiber which offers a fixed IP address which will allow you to connect more easily to your machine. There are parades for other operators revolving around services that will make the link between your physical machine and a defined address regardless of the IP assigned by your operator.

The principle of installation and configuration therefore remains generally perfectly identical regardless of the operator. If you have always wanted to create a homemade server, if you have an unused miniPC lying around you, if you want to rub the exercise, I can only advise you to browse the tutorial offered. It is a wonder.

Create a new registered server (SQL Server Management Studio)

This section explains how to record connection information relating to the servers you frequently access by registering it in the sql server management studio server component in SQL Server. A server can be registered before connection or when connecting from the object explorer. There is a menu option that allows you to register server instances on the local computer.

There are two types of servers registered:

    Local servers groups use local servers groups to easily connect to the servers that you manage frequently. Local and non -local servers are registered in groups of local servers. Local servers are unique to each user. For more information on how to share server information registered, see Export information from the served servers (SQL Server Management Studio) and import information from the registered servers (SQL Server Management Studio).

Notes we recommend using Windows authentication as far as possible.

Use of SQL Server Management Studio

To create a new registered server

  1. If the registered server element is not visible in SQL Server Management Studio, in the menu Display, click on Served servers. Server type
    When a server is registered from registered servers, the area Server type is read alone and corresponds to the type of server displayed in the registered server shutter. To register another type of server, click on Database, Analysis server, Reporting ServicesOr Integration Services in the toolbar Served servers Before you start registering a new server. Server name
    Select the server instance to register in the following format: [\]. Authentication
    Two authentication modes are available when connecting to an instance of SQL Server. Windows authentication
    Windows authentication mode allows the user to connect by means of a Microsoft Windows user account. Authentication SQL Server
    When a user connects with a connection name and a password specified from an unprecedented connection, SQL Server himself makes authentication by checking if a SQL Server connection account has been defined and if the word specified pass corresponds to that recorded previously. If SQL Server does not have a connection account, authentication fails and an error message is sent to the user.

Important when possible, use Windows authentication. For more information, see choose an authentication mode.

username
Specifies the current username with which you connect. This reading option alone is only available if you have chosen to connect via Windows authentication. To modify User names, Open a session on the computer as a different user. Connection
Enter the access name with which to connect. This option is only available if you have chosen connection with the SQL Server authentication . Password
Enter the password used with connection. This option can be changed only if you have chosen to connect via the SQL Server authentication . Remember password
Select this option so that SQL Server figure and stores the password entered. This option is only displayed if you have chosen the connection with the SQL Server authentication .

Notes if you have stored the password and no longer want to keep it in memory, uncheck the box, then click on Save.

Multi -service requests

The REQUIRY editor window in SQL Server Management Studio can connect to several instances of SQL Server and question them simultaneously. The results returned by the request can be merged into a single or returned results component in separate results aspects. As an option, the request editor may include columns that provide the server name that has produced each line and also the connection used to connect to the server having provided each line. For more information on how to perform multi -service queries, consult running instructions simultaneously on several servers (SQL Server Management Studio).

To run requests on all servers of the local server group, right -click the server group, point to To log in, then click on New request. When the requests are executed in the new window editor’s window, they run on all group servers using stored connection information (including the user authentication context). Any connection of a server registered using the SQL Server authentication but does not record the password is doomed to failure.

To perform requests on all servers registered with a centralized management server, develop the centralized management server, right -click the server group, point to To log in, then click on New request. When the requests are executed in the new request editor window, they run against all servers in the server group, using stored connection information and the Windows authentication context of the user.