"Aliyun" WindowsServer2012 configuration apache+php Environment, open 8080 ports through the firewall

Source: Internet
Author: User
Tags configuration php aliyun

Configuration Description:

Cloud service provider: Aliyun

Server os:windowsserver2012 (64bit)

Goal: Configure the apache2.4+php5.5 environment

Note:

Since I rented the Aliyun RDS database, this is not the place to install MySQL.

Because the Aliyun WindowsServer2012 is 64bit, so the resource bits downloaded in this article are 64 bits, if you are using 32bit, download 32-bit resources


One: Download Resources

1. Download VC11 Vcredist_x64.exe (32-bit download VC11 vcredist_x86.exe), because only IIS is installed on the cloud server and there are no other environments. Recommended to download English version.

2. Apache Httpd-2.4.9-win64-vc11.zip (32-bit URL is the same) since 2.2 after the Apache official website no longer update the win version, so provide the address is: http://www.apachelounge.com/ download/#tc_qz_original =1440365482

3. Download php php-5.5.10 http://windows.php.net/download/#tc_qz_original = 1440365482 Select thread safe version VC11 x64 thread safety


Two: Installation configuration

A. Installation of VC11 Vcredist_x64.exe

B. Install configuration PHP

1. Extract PHP to the custom directory, I choose the same as the default directory: C:/php55

2. Add C:\php55 and C:\php55\ext to the environment variable path

3. Copy the C:\php55\php.ini-production and rename it to PHP.ini

4. Open several commonly used PHP extensions, with Notepad opened C:\php55\php.ini

Modify 721 rows; Extension_dir = "ext" => extension_dir = "ext" (remove the semicolon before extension)


Modify the 873 row; Extension=php_mbstring.dll => Extension=php_mbstring.dll (remove the semicolon before extension, which is a php multibyte string extension)


Modify 875 row; Extension=php_mysql.dll => Extension=php_mysql.dll (remove the semicolon before extension)


Modify 876 row; Extension=php_mysqli.dll => Extension=php_mysqli.dll (remove the semicolon before extension)


5. Enter Php-v in CMD to verify that the installation is successful

C. Installation configuration Apache

1. Extract Apache to custom directory, I choose the same as the default directory: C:/apache24

2. Open C:\apache24\conf\httpd.conf (recommended to use notepad++ can see line number)

Note: Because the default IIS server uses port 80, I make Apache use port 8080, which tells WindowsServer2012 how to open port 8080

Modify the 37 line ServerRoot "C:/apache24" => serverroot "C:/apache24" (Here is where you unzipped the Apache installation package)


Modify 58 line Listen => Listen 8080


Modify 217 lines #ServerName www.example.com:80 => ServerName www.example.com:8080 (remove front #, set port number 8080)


Modify the 241 line DocumentRoot "C:/apache24/htdocs" => documentroot "D:/websites" (this directory is the Apache server's virtual root directory, you can set yourself)

Modify 242 lines <directory "C:/apache24/htdocs" > =><directory "D:/websites" > (Consistent with 241)

Modify 262 lines allowoverride none=> allowoverride all

Modify 267-269 Lines

Require all granted
Order Deny,allow
Allow from all


Modify Line 275 DirectoryIndex index.html => directoryindex index.html index.php (we added index.htm index.php)


Modify 358 lines scriptalias/cgi-bin/"c:/apache24/cgi-bin/" => scriptalias/cgi-bin/"c:/apache24/cgi-bin/" (Still not change)


Modify 374 lines <directory "C:/apache24/cgi-bin" > => <directory "C:/apache24/cgi-bin" > (Still no change)


Add on C:\Apache24\conf\httpd.conf last line

LoadModule php5_module "C:/php55/php5apache2_4.dll" (this is related to the package you downloaded)
AddType application/x-httpd-php. php. html. htm (note, spaces between. php. html. htm)
Phpinidir "C:/php55" (Consistent with your PHP installation directory)

3. Installation

Open cmd, pay attention to WindowsServer2012 in the PowerShell and CMD still have a difference, shortcut key win+x choose to open cmd

Enter c:\Apache24\bin\ (your Apache installation directory)

Execute httpd-k Install (This command cannot be executed with PowerShell)

4. Enter c:\Apache24\bin\ (your Apache installation directory)

Double-click to run ApacheMonitor.exe

No surprise, then the lower right corner has Apache icon, in their own server cloud host from the browser localhost:8080 and ip:8080 can be found to be successful.


Possible error Analysis:

1. The Apache panel in the lower right corner shows no services installed. Indicates that Apache is not successfully installed.

2. Type localhost:8080 on the server and ip:8080 cannot be displayed. Description httpd.conf Configuration Error

3. The server can access the extranet via ip:8080. Description 8080 port is not open. You can use Netstat-ano to view the port opening in CMD.

But through the extranet to access the server ip:8080 to find that cannot connect. This is because the default 8080 port is not open. The steps are as follows:


Aliyun WindowsServer2012 Open the 8080 port method:

1. Go to Control Panel Select Firewall, select Advanced Settings

2. Select the inbound rule to the left, click the new rule on the right

3. Select port

4. Select TCP below the specific port fill 8080

5. Allow connections

6.

7. Complete


At this time through the extranet can be ip:8080 way to access the Apache server.





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.