WindowsServer2012 build server container (Apache+php+Mysql)

1. Needs before building

vmware

Download and install the virtual machine vmware15
network disk address:
link: https://pan.baidu.com/s/1C4gUT7FfyK8vkScC235-YA
extraction code: sang

windows2012 mirror download

Thunder download ed2k://|file|cn_windows_server_2012_r2_vl_x64_dvd_2979220.iso|4453249024|1F71685C7E33ED30FDC439C7FE0E4E5A|/

Install windows2012

  1. Create a new virtual machine, click Customize, and the next step
    Insert picture description here
  2. After the option to select the compatibility of the virtual machine appears, ignore it and continue to the next step, the image file selection appears, select later and then the next step
    Insert picture description here
  3. The selection system appears, find winserver2012, continue to the next step
    Insert picture description here
  4. You need to choose the virtual machine to obtain the name after installation. You can take a random one, and then put the C drive in a stupid way. It is best to put the entire folder in a specific area by yourself and continue to the next step.Insert picture description here
  5. Select BIOS to boot and continue to the next step
  6. Allocate cpu, according to your own cpu number, if you don’t know the number of cpu, click on the performance in the task manager, then click on the resource monitor, look at the green real-time statistics grid on the right, and pull down to see your own cpu , Then the number of your computer's cpu is (x+1). Here you depend on the situation and cannot be greater than x+1.
  7. Choose the memory, it depends on the situation. According to the amount of memory of your computer, my 20G storage, I generally like to only give 2-4G to the virtual machine, which is too wasteful, and then continue to the next step.
    Insert picture description here
  8. Selecting the network
    (1) Bridge is to connect directly to the wifi at home, the level is the same as other devices, and other devices can access this virtual machine. ( Insecure, not suitable for servers, and easy to squeeze the intranet ip of other devices )
    (2) NAT mode is to open another network segment, but there is a virtual network card, so it can communicate with the host.
    (3) Only Host mode, the first two can be connected to the Internet, but the third can only communicate with the host (client).
    Here you can choose the first two, depending on personal preference, continue to the next step
    Insert picture description here
  9. The choice of IO controller The
    LSI Logic SAS(S) recommended by the system here is the most suitable for the server system,
    while the above LSI Logic(U) is the most commonly used for home computers.
    We choose LSI Logic SAS, and then the next step
    Insert picture description here
    10. Disk selection, scsi It is used to simulate some installations of bai of the server, others are suitable for ordinary systems, continue to the next step
    Insert picture description here
  10. Create a new virtual disk and continue to the next step
  11. Disk
    allocation The size of the disk memory allocated here is the largest disk occupies the size of the physical machine, and for general servers, try to choose a larger one, here is 60G.
    For the following options, the first is to divide the disk into small pieces, which can be applied to systems with multiple small software operating modes (reducing internal fragmentation), and the second is to apply to systems running large programs, reducing external Fragmentation. Splitting the disk here will slow down the running speed of the server, so choose the second one.
    Insert picture description here12. Then continue to the next step until the final completion.
  12. Before starting and running the virtual machine, arrange the mirroring first, then confirm, click Run
    Insert picture description here14. The next step is to operate the next step until you select the system type, select the standard system of the GUI graphical interface, and then continue to the next step
    Insert picture description here15. Accept the license Then click Next, and select Custom to enter the partition.
    Click New. I spent 40G here to prepare it as a C drive, then click New to use the remaining space as another partition, and then click the 40G partition and click Next. Insert picture description here16.Wait for installation
    Insert picture description here

2. Install php5.6+Mysql5.6+Apache2.4

Download three compressed packages . Netdisk
address:
link: https://pan.baidu.com/s/15nn4qI6GW7kiv6sSHr4ABA
extraction code: sang

Mysql5.6 installation and problems

When the installation package is opened, a window will definitely pop up, saying that NET.framework is required, here I am ready for you

Link:
https://pan.baidu.com/s/1WII4E8JolUHDwz7x9r1ALg
Extraction code: sang

The installation of the database is simple, and the security method is the same as usual. I won't say much here. Finally, remember to configure the Path environment.

3.Apache

  1. Download and unzip Apache24 to any disk location, here is Disk E, and rename it to Apache2.4.
    Insert picture description here
    2. Open the httpd.conf file in the Apache2.4 conf directory; modify Define SRVROOT ":/Apache2.4" to the Apache2.4 file path, here is Define SRVROOT "E:/Apache2.4".
    Insert picture description here
  2. The port number can be changed or not. The default 80 is actually quite convenient without entering the port number. If you need to change it, search for Listen 80 in the conf file and change it to 88. You need to bring the port number when you access the website later.
    Then we test the result, open cmd in the Apache24/bin directory, and type httpd to
    open Firefox and enter 127.0.0.1 (but there is no PHP setting to let Apache load the PHP script)
    Insert picture description here

httpd cannot be started (missing files required by the environment)

When winserver2012 starts httpd, the pop-up window lacks vc++14 components, so some components and updates need to be installed, here I am ready for everyoneInsert picture description here

Link: https://pan.baidu.com/s/1uBTtnO8Qf7SCk8QZkQcklg
Extraction code: sang

The content is relatively simple, and the comment section will give you an explanation

4.PHP

  1. Download and unzip PHP5.6 to any disk location, here is Disk D, and rename it to php.
  2. Configure the php.ini file

(1) First change the suffix of the php.ini-production file in the php installation directory to php.ini
(2) Open php.ini and make the following changes:

查找;extension_dir = "./" ,将分号去除
并在后面写上如下数据
extension=php_mbstring.dll
extension=php_mysql.dll
extension=php_mysqli.dll

(3) Find; date.timezone = set to date.timezone = Asia/Shanghai

End of php.ini file configuration

5. PHP and apache connection settings

  1. Open httpd.conf under Apache's conf directory and search for #LoadModule xml2enc_module modules/mod_xml2enc.so, and append the following code at the end:
LoadModule php7_module D:/wangshuyi/php7/php7apache2_4.dll

2. Find the part of #AddEncoding x-gzip .gz .tgz, and add the following current code at the end:

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
  1. Specify the php.ini configuration file path

Specify the directory of the PHP configuration file php.ini in the httpd.conf file, locate the end of the httpd.conf file here, and add the following code to the last line of the text:

PHPIniDir "E:/Apache24/php-5.6.39-Win32-VC11-x64/" "   (这里的路径是你php的根目录)

4. Remove the comment (#) of the following two lines of code

#LoadModule rewrite_module modules/mod_rewrite.so

#LoadModule vhost_alias_module modules/mod_vhost_alias.so

6. Test

Write a php script in the htdocs directory under the Apache24 directory

<?php
$GET=$_GET['id'];
if($GET=="123"){
    
    
echo "密码正确";
}else{
    
    
echo "密码错误!请重新输入";
}	
?>

Then enter 127.0.0.1/index.php/id=12333323456 in the Firefox address bar, the result is as follows, the build is successful!
Insert picture description here

Guess you like

Origin blog.csdn.net/BlackBtuWhite/article/details/107438397