web (iis 7.0)

56
Installation d’un serveur web (IIS 7.0) sur Windows Server 2008 Introduction Nous allons voir au cours de ce billet comment installer simplement un serveur web sur Windows Server 2008. Nous verons ensemble l’installation du serveur web de Microsoft : IIS qui est intégré à Windows Server 2008. Sur un Windows Server le serveur web IIS est un rôle à ajouter à notre système. Une fois ajouté notre Windows Server peut faire office de Serveur Web. Installation L’installation concernera IIS 7.0 sur un Windows Server Standard 2008. Pour commencer il est fondamental d’être connecté en tant qu’administrateur « local » pour pouvoir ajouter le rôle IIS. Pour ajouter le role serveur web IIS: Menu démarrer -> Tout les programmes -> Outils d’administration -> Gestionnaire de Serveur. Si on est pas connecté en tant qu’administrateur local, un message de sécurité va apparaitre dès l’ouverture du gestionnaire de serveur. Une fois arrivé sur cette fenêtre vous aller voir un résumé de la configuration de votre Windows Server 2008. Dans le résumé des roles cliquer sur « Ajouter des roles ». Une fois cela fait nous arrivons sur la fenêtre d’assistant d’ajouts de roles. Avant de commencer à ajouter des rôles Windows Server nous propose une aide qui nous rappel les pré- requis importants avant d’ajouter un role: un mot de passe administrateur sécurisé, une connectivité réseau configuré et les mises à jour serveur faites.

Upload: lydialamia

Post on 25-Oct-2015

23 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: web (IIS 7.0)

Installation d’un serveur web (IIS 7.0) sur Windows Server 2008

IntroductionNous allons voir au cours de ce billet comment installer simplement un serveur web sur Windows

Server 2008. Nous verons ensemble l’installation du serveur web de Microsoft : IIS qui est intégré à

Windows Server 2008. Sur un Windows Server le serveur web IIS est un rôle à ajouter à notre

système. Une fois ajouté notre Windows Server peut faire office de Serveur Web.

InstallationL’installation concernera IIS 7.0 sur un Windows Server Standard 2008. Pour commencer il est

fondamental d’être connecté en tant qu’administrateur « local » pour pouvoir ajouter le rôle IIS.

Pour ajouter le role serveur web IIS: Menu démarrer -> Tout les programmes -> Outils

d’administration -> Gestionnaire de Serveur. Si on est pas connecté en tant qu’administrateur

local, un message de sécurité va apparaitre dès l’ouverture du gestionnaire de serveur.

Une fois arrivé sur cette fenêtre vous aller voir un résumé de la configuration de votre Windows Server

2008. Dans le résumé des roles cliquer sur « Ajouter des roles ». Une fois cela fait nous arrivons sur

la fenêtre d’assistant d’ajouts de roles. Avant de commencer à ajouter des rôles Windows Server nous

propose une aide qui nous rappel les pré-requis importants avant d’ajouter un role: un mot de passe

administrateur sécurisé, une connectivité réseau configuré et les mises à jour serveur faites.

Page 2: web (IIS 7.0)

Une fois l’aide lue cliquer sur suivant. Maintenant nous devons choisir les rôles. Vous avez un panel

de roles sous Windows Server, nous choisirons Serveur Web IIS. Windows Server vous demandera

d’ajouter certaines fonctionnalités pour permettre l’installation de IIS 7.0. Acceptez et continuer.

NB: Vous pouvez voir que Windows a intégré un descriptif à chaque role, utile pour ceux qui ne sont

pas familiarisé avec Windows Server 2008 et avec la notion de role.

Une fois accepté, comme souvent dans Windows Server 2008, vous aurez un petit assistant qui vous

résumera la fonction du Serveur Web IIS et ses fonctionnalités. Tout cela est de la lecture et si vous

ne savez pas où vous mettez les pieds il peut s’avérer fort utile de lire la documentation.

Une fois lu, Windows listera toutes les fonctionnalités que vous pouvez intégrer à votre serveur web. À

vous, selon votre utilisation de choisir uniquement les fonctionnalités qui vous seront utiles ou

requises.

Faites suivant, et laissez Windows faire l’installation de votre serveur IIS. Une fois fini vous avez

installé un Serveur Web sur votre Windows Server 2008. Ce rôle est alors actif, pour le configurer et le

gérer il vous suffit d’aller à Menu démarrer -> Tout les programmes -> Outils d’administration ->

Gestionnaire des Services Internet IIS. Sur cette interface, vous retrouverez la liste des sites

présents sur votre serveur, il vous permet d’ajouter un site et de gérer les sites (authentification,

certificats, pages d’erreur…). Cette interface est très « userfriendly » comme la plus part des

interfaces sous Windows server 2008, n’hésitez pas chercher les moindres petit détails de ce

gestionnaire très complet.

Page 3: web (IIS 7.0)

L’installation est faites et vous avez déjà un site d’exemple sur votre serveur, pour le visualiser clique

sur « Default Web Site » et dans le menu de droite faite aperçu, ci-dessous un exemple:

Enfin dans l’installation de IIS 7.0 nous allons ajouter un site d’exemple qu’il s’appelera Blog. Pour

cela j’ai glissé un site fait en html et css dans le dossier C://inetpub//wwwroot. Mon site est dans un

dossier appelé Blog. Donc pour l’ajouter vous faite clique droit sur « Sites » ==> Ajouter un site. Puis,

renseignez les champs: nom du site, lien physique du site, port…

Une fois ajouter si vous n’avez pas changé de port (80 par défaut) vous devez arrêter le site par

défaut car il fonctionne déjà sur ce port. Une fois fait dans le menu du site faite visualiser le site et

vous verrez votre site !

 

Page 4: web (IIS 7.0)

ConclusionNous avons vu comment installer simplement un serveur Web IIS 7.0 sur un Windows Server 2008.

L’installation est simple et les fenêtres intuitives. Mais au niveau de la configuration cela peut être bien

plus compliqué que de glisser un site dans un dossier, surtout si vous voulez créer un site via un CMS

tel que WordPress ou autre, ou utiliser une plateforme spécifique.

Quel type de site type de site web hébergez-vous ou voudriez-vous héberger ? Quels sont les

serveurs web que vous souhaitez installer ?

Pour démarrer ou arrêter un serveur WebVous pouvez effectuer cette procédure à l'aide de l'interface utilisateur ou d'une ligne de commande. Pour plus d'informations sur l'ouverture du Gestionnaire des services Internet (IIS), consultez Ouvrir le Gestionnaire des services Internet (IIS   7) .Utilisation de l'interface utilisateur

1. Ouvrez le Gestionnaire des services Internet (IIS) et accédez au nœud du serveur Web dans l'arborescence.

2. Dans le volet Actions, cliquez sur Démarrer pour démarrer le serveur Web ou sur Arrêter pour l'arrêter.

Utilisation d'une ligne de commande1. Ouvrez une fenêtre de ligne de commande où vous disposez de droits élevés.2. À l'invite de commandes, tapez net stop WAS et appuyez sur ENTRÉE ;

tapez Y et appuyez sur ENTRÉE pour arrêter également W3SVC.3. Pour redémarrer le serveur Web, tapez net start W3SVC et appuyez sur ENTRÉE

pour démarrer WAS et W3SVC.

Page 5: web (IIS 7.0)

How to install PHPMyAdmin on Windows Server 2008 richardreddy 

 Jun 15 2012 10:15 AM

 MySQL, PHP, PHPMyAdmin

 Comments

At present if you install Wordpress as part of the Web Platform Installer it does not install

PHPMyAdmin for you. Luckily this install is very easy to do.

Head over to http://www.phpmyadmin.net and download the latest installer to your server.

Once downloaded unzip the contents of the file and rename the folder to 'phpmyadmin'.

Copy this folder to your website containing Wordpress or php.

Open the file config.sample.inc.php into wordpad (notepad puts it all on one line) and enter in a

new Blowfish_secret. It can be anything random like a password.

Next uncomment:

// $cfg['Servers'][$i]['controluser'] = 'pma';

// $cfg['Servers'][$i]['controlpass'] = 'pmapass';

and replace with the root database username and password or create a new mySQL user called

pma and use those details here.

Now uncomment the Storage database and tables - just remove the leading // from each line.

Save and close the config file. Rename it to: 'config.inc.php'.

Copy the phpmyadmin folder and paste it into your website root level.

Go to the Examples folder and open the create_tables.sql file using notepad. Copy all the content

in here.

Open your website in a browser and point to yourdomain.com/phpmyadmin

Login using your root database and password. Ignore all the error messages for the moment. Go

to SQL and paste in the sql text you copied. Now click on Go.

Log out of phpmyadmin and log in using the database username and password you used when

setting up your Wordpress/MySQL database for this project.

Everything should now be working as expected for you.

Page 6: web (IIS 7.0)

Install PHPMyAdmin on IIS7 and Server 2008By Dave Lawlor

After installing our copy of MySQL on IIS7 and Server 2008, you might be wondering what to do next. Well if you don’t feel like learning the command line sequences for MySQL you might be interested in using a web based GUI based tool which will make managing the databases a lot easier.

This tool is called PHPMyAdmin and can be found at www.phpmyadmin.net.

What will you be able to do with PHPMyAdmin in the database? Here is a list of some of the features:

browse and drop databases, tables, views, fields and indexes create, copy, drop, rename and alter databases, tables, fields and indexes maintenance server, databases and tables, with proposals on server configuration execute, edit and bookmark any SQL-statement, even batch-queries load text files into tables administer multiple servers create and read dumps of tables search globally in a database or a subset of it

And that is just the short list of features of this very powerful application. It recently was named Best of Open Source Platforms and Middleware by Infoworld.

Note: PHPMyAdmin requires both PHP and MySql to be installed on the server. If you need to please refer back to my articles on installing them:

Installing PHP Installing MySql

Download and Install PHPMyAdminOk so now that we know why we should install it, let’s get to the actual installation part. But before we begin, let’s go download the software at:www.phpmyadmin.net/home_page/downloads.php.

The current version as I write this article is 2.11.9, so I am going to go ahead and download that to get started. Which version you use will depend on your environment; I am going to use the english.zip for this demo. Let’s get started!

1. Extract the files from the archive to a site that is available on the web server (remember the application is web based).

For this demo I am going to use C:\inetpub\wwwroot\phpmyadmin

Page 7: web (IIS 7.0)

2. Now start IIS Manager and expand the default website; right click onphpmyadmin and left click on Convert to Application.

Page 8: web (IIS 7.0)

3. You can leave the default settings in place for the Add Application window and click OK.

Page 9: web (IIS 7.0)

4. Create a folder to save your PHP sessions; for our example I am going to useC:\temp\phpsessions and give full rights to the following users:

IUSRIIS_IUSRSNetwork Service

5. Now go into your php directory and find php.ini — we have to make a few changes:

Find session.save_path and set it to the same as you used in step 4 which in our case is C:\temp\phpsessions and save the file.

Page 10: web (IIS 7.0)

6. Please note that this application requires the following extensions for PHP:

MySQLGDMBSTRING

If you do not have these on your server already, please install them. If you are using my article to install PHP then in step 6 just add the above extensions to your installation, or if you already installed it rerun the installer msi file and modify your installation to include these extensions.

To check if they are installed do a search for extension=php_mysql in thephp.ini and you should see it uncommented.

Do the same for the other extensions:

Page 11: web (IIS 7.0)

extension=php_gd2.dllextension=php_mbstring.dll

7. Go into IIS Manager, go to the default site (that is if you have been following my demo, if you have been modifying your site location or path then use that) and click on Default Document.

Page 12: web (IIS 7.0)

8. In the right pane click Add…

Page 13: web (IIS 7.0)

9. In the dialog box type index.php and click Ok.

10. Go to the directory that you unzipped PHPMyAdmin to and look for a file named config.sample.inc.php and open it in Wordpad. (You can use notepad but it tends to jumble everything up)

11. Now find the line $cfg[‘blowfish_secret’] = ‘’; you have to fill in this line with anything that you want but it needs to be a value.

Page 14: web (IIS 7.0)

Only up to 46 characters and it can be alphanumeric. In this case I am going to use trainsignal1111TST

12. Go down to you see the section User for advanced features and uncomment (Remove the // from the front of the line) the two lines under that and change the pmapass to a different password, for this demo I am going to usetrainsignal.

Page 15: web (IIS 7.0)

13. next, go down to the next section Advanced phpMyadmin features and uncomment all the lines under it (remove the // from the front of the line).

Page 16: web (IIS 7.0)

14. Now save this file as config.inc.php

15. Point your browser to http://localhost/phpmyadmin/ (if you have been following this example; if you have used a different site/directory then point to that) and you should see a login page.

Type in the userid and password for your local MySql server, then click Go.

Page 17: web (IIS 7.0)

16. Now you are in and able to manage your MySql instance!

As a quick test let’s create a database by scrolling to the Database link and clicking on it

Page 18: web (IIS 7.0)

17. Type in the name of your new database, for this example I am going to useTrainsignaltraining and then click Create.

Page 19: web (IIS 7.0)

18. You will now see a page that confirms that database Trainsignaltraininghas been created.

Page 20: web (IIS 7.0)

That’s all there is to it, now you can quickly and easily manage you MySql databases on IIS7 through PHPMyAdmin.

Page 21: web (IIS 7.0)

IIS 7: Install FastCGI PHP on Server 2008By Dave Lawlor

One of the major advantages that the Apache web server enjoyed over IIS for years has been the native support for PHP. Most Windows Hosting you get will, if you’re lucky, install PHP for you but not support it at best.

This left some of the best open source programs out there too much of a hassle for most users. With the release of the FastCGI module you can now reliably host PHP programs on IIS.

Let’s go ahead and walk through installing the Fast CGI Module and PHP.

How to Install FastCGI on Server 2008A few prerequisites for installing FastCGI would seem obvious but let’s go ahead and mention them anyway.

The first of course is an installation of Server 2008 (though this works on Vista if you are so inclined) and having IIS 7 installed already. You can also enable FastCGI while installing IIS, but for this demo I already have a virtual server with IIS 7 installed so let’s go with that.

If you need help installing the web server you can read my article on Installing IIS 7. Now let’s start:

1. Open Server Manager.

2. In the left pane expand Roles and click Web Server (IIS), then in the center pane scroll down and click Add Role Services.

Page 22: web (IIS 7.0)

3. Next on the Select Role Services screen select CGI, under Application Development, then click Next.

Page 23: web (IIS 7.0)

4. Confirm Installation Selections by reviewing the options you picked and then click Install.

Page 24: web (IIS 7.0)

5. You should see Installation Succeeded on the Installation Results screen; go ahead and click Close.

Page 25: web (IIS 7.0)

6. You will now see the CGI role service under the IIS panel.

Page 26: web (IIS 7.0)

Now that wasn’t too bad was it? You will notice that you installed CGI instead ofFastCGI, but by selecting CGI it enables both. Now let’s move on to installing PHP!

How to Install PHP on IIS 7When dealing with PHP there are many different versions that are in use and depending on the application you are going to be using you may need a specific version. There are also repackaged versions like those from Zend that are pre-packaged and optimized extensions that work together.

If you want to use the official release you can get it from:http://www.php.net/downloads.php

For this demo I am going to use PHP 5.2.6 Non-thread-safe installer underWindows Binaries. It is recommended to use the non-thread safe build with IIS 7 since FastCGI will ensure single threaded execution environment.

Once you download it to your server let’s get started.

1. Left click on the PHP Installer Binary.

2. You will now see the PHP Setup Wizard window, go ahead and click Next.

Page 27: web (IIS 7.0)

3. On the End-User License Agreement, go ahead and place a check in the box accepting the terms in the License Agreement and then click Next.

4. Now select a destination folder, for our example I am going to use C:\PHP5\, type or navigate to where you want to install it and click Next.

Page 28: web (IIS 7.0)

5. Now select IIS FastCGI as the web server and click Next.

6. The Choose Items to Install screen is next. I am going to stick with the default, as adding extensions that you don’t need increases your vulnerability profile.

Page 29: web (IIS 7.0)

If you have need of an additional Extension just open up the drop down and choose it, then click Next.

7. Here comes the big moment! Click Install and watch the magic happen.

8. You should see the Setup Completion screen now. Go ahead and clickFinish.

Page 30: web (IIS 7.0)

9. Ok, now we will have to make a few modifications to the way PHP handles itself so we are going to modify the php.ini file.

First navigate to the place you installed PHP and open php.ini in notepad.

Page 31: web (IIS 7.0)

10. First let’s modify fastcgi.impersonate and set it to 1. Remember you are going to have to uncomment these first and then change the value, and alsoCTRL+F is your friend!

Page 32: web (IIS 7.0)

11. Now find cgi.fix_pathinfo and set it to 1 also, remember to uncomment by removing ;

12. Next up is cgi.force_redirect and we are going to set this to 0, and uncomment.

Page 33: web (IIS 7.0)

13. Then let’s set open_basedir to the root level of our website content directory, which I will use the default C:\inetpub

14. Now save your changes to php.ini

Page 34: web (IIS 7.0)

That’s it! Let’s go ahead and test the install, by going to a command prompt and doing the following:

1. Open a command prompt.

2. Navigate to the directory you installed PHP to.

3. Type in: PHP –info and you should see a lot of scrolling and information. This means PHP is good to go.

Below is the start of the command and output, then the second picture is the last thing that will be shown.

Page 35: web (IIS 7.0)

You have now properly installed and tested PHP on the server. Now we have to configure IIS 7 to use PHP through FastCGI.

How to Configure IIS7 to use PHPIIS7 can be configured to handle PHP mappings at server or site levels, but for this example we are going to set the configuration at the server level. This just basically tells the server how to handle files with .php type extensions.

1. Open IIS Manager and select the server in the left pane and then click onHandler Mappings in the center pane.

Page 36: web (IIS 7.0)

2. In the right Action pane select Add Module Mapping…

Page 37: web (IIS 7.0)

3. Fill out the following information and click OK:

Request Path: *.phpModule: FastCgiModuleExecutable: {path to your PHP install}\php-cgi.exeName: Whatever you want

4. You will get a popup asking if you want to create a FastCGI application, go ahead and click Yes.

5. You will now see your enabled handler in the list.

Page 38: web (IIS 7.0)

You have now successfully setup your IIS7 web server to handle PHP files via FastCgi. But don’t take my word for it, let’s go ahead and run a test.

1. Navigate to the default site directory at C:\inetpub\wwwroot

2. Create a file called info.php and place the following in the file:

<?php phpinfo(); ?>

3. Open your browser and point it at http://localhost/info.php and you should see a PHP information page similar to this:

Page 39: web (IIS 7.0)

This shows a successful handling of PHP files by IIS7. You have now configured your server to run PHP via FastCGI on IIS7.

My next article in this series will talk about installing some of the more popular databases and applications that can use PHP. If you have any requests feel free to leave a comment.

Page 40: web (IIS 7.0)

Install MySQL on IIS7 Server 2008By Dave Lawlor

Now that you have installed PHP on your server, most of the popular PHP applications like WordPress & Joomla will require a database on the backend to support them.

While there are other options, MySQL is usually the database of choice to use for these applications. It is one of the most widely supported databases so you can usually find help if you run into a snag.

In this article we will install MySQL 5 on a Windows Server 2008 running IIS7.

How to Install MySQL on IIS7As of this writing the current production version of MySQL is 5.0 Community, so that is what we are going to use for this example. We are also going to use the installer package, which can be downloaded at the following location:

MySQL Windows 32-Bit —http://dev.mysql.com/downloads/mysql/5.0.html#win32 MySQL Windows 64-Bit —http://dev.mysql.com/downloads/mysql/5.0.html#winx64

In this case we are going to use the 32-bit "Essential" binary which is recommended for most users, so I am going to go ahead and have that downloaded onto our test machine and then we will get going.

1. Find where you downloaded the file and click on the .msi file.

Page 41: web (IIS 7.0)

2. At the setup wizard click Next.

3. I am going to choose the Typical install and then click Next.

4. Review your chosen options then click Install.

Page 42: web (IIS 7.0)

5. Next you will see an advertisement to upgrade to MySQL Enterprise version. For some that is a good option as you get quite a bit of benefit from having the service relationship in place compared to the community addition.

You can read the ad or click for more information, but if you want to continue installing the software click Next

6. Now you will see an advertisement for their monitoring service to keep a professional eye on your database. If you have a need for such service I encourage you to click the More button, but otherwise click Next.

Page 43: web (IIS 7.0)

7. You should now arrive at the Wizard Completed window. Leave the boxConfigure the MySQL Server now checked and click on Finish.

8. Now we will see the MySQL Server Instance Configuration Wizard, which will walk you through configuring your MySQL installation. Go ahead and click Next.

Page 44: web (IIS 7.0)

9. In the next screen we will see two different options Detailed & Standard, I am going to go ahead and select the Detailed and click Next.

10. The MySQL Instance Configuration screen is next, you have three options:

Developer Machine — Many other apps will be running on this machine and MySQL should use a minimal amount of memory.

Page 45: web (IIS 7.0)

Server Machine — Server apps will be running, this is the setting to use for web servers, MySQL will use a medium amount of memory.

Dedicated MySQL Server Machine – The big papa of installation choices, MySQL will be the only application on this server and will utilize all available memory.We are going to go ahead and choose Server Machine for this demo, then click Next.

11. Now we have to select the database usage. There is a lot that can be said for this but I am going to give you a quick summary:

The choices here boil down to what you are going to be using the database for and what feature set you need. The main difference between the MyISAM andInnoDB is speed and reliability. If you need transactional support you should know it and you would know to select Transactional Database to use InnoDB and use that.

In our demo we are going to use the Multifunctional Database to give us the greatest flexibility. After selecting that click Next.

Page 46: web (IIS 7.0)

12. On the next windows you choose the place to put the InnoDB datafile.

If you have a raid or array storage you may want to move it there for performance/reliability reasons, but for this demo we will use the default and click Next.

13. The next decision to make is how many connections to set the server up for.

Page 47: web (IIS 7.0)

Since this is going to be on a web server I am going to set it up to use 500 active connections at one time by selecting Online Transaction Processing (OLTP), but note that you can also setup a custom number by using the Manual Setting.

If I was working on a development box I would have probably selected Decision Support as that assumes 20 connections and would be ideal for just test purposes. After you make your decision click Next.

14. This next screen is very important because it sets how other applications will connect to your MySQL instance.

The default port is 3306 and it is recommended that you leave this as is because it is the assigned port and most 3rd party applications you use will try to connect on that port. Now if you are coding your own application and can customize the port the application will use, then you could change the port.

You can also add a firewall exception by checking the box next to the port number. This is tricky depending on how your environment is going to be setup. I am going to add the exception for this demo but you may want to be more restrictive and only open the exception to the servers that would be connecting to the MySQL apps.

Enable Strict Mode is another added feature to MySQL 5 and it is recommended to leave it on. This basically does some data checks and forces applications to use correct formats.

Note: This may break some legacy apps that used older MySQL versions, but it is more preferable to patch those apps and keep this mode enabled.

Page 48: web (IIS 7.0)

After making your selections click Next.

15. Now we will set the default character set that the database will use.

Again this will really be dependent on what your environment is, but for this demo we are going to use Best Support for Multilingualism as that supports most languages. If you know you are going to be using a specific set than you can also set that by using the Manual option.

After you are done go ahead and click Next.

Page 49: web (IIS 7.0)

16. The next screen will setup MySQL to run as a service so if there are any reboots the database will come back up automatically. You can also set the Service name which is useful if you have more than 1 instance of MySQL running.

You can also select Include Bin Directory in Windows Path to add the server/client variables into the PATH variable. This is useful if you will be working from the command line for any reason.

For this demo we are going to select it and then click Next.

Page 50: web (IIS 7.0)

17. Now let’s set a root password for the MySQL server instance. Type it in twice to confirm it, but leave Enable root access from remote machines unchecked unless you know you will need that.

Also leave Create An Anonymous Account unchecked as that could cause security issues.

Page 51: web (IIS 7.0)

18. Finally we arrive at the final configuration window. All that is left is to click onExecute to setup the MySQL instance. Go ahead and click … you know you want to!

19. You will see a brief summary at the end of the install that will let you know everything completed successfully and ask you to click Finish.

Now that you have a powerful database like MySQL installed on you server it gives you quite a few options for some great open source apps when combined with PHP and other programming languages.

My next article will be how to use some graphical applications to manage your MySQL databases.