Get the App
SLTechnology News&Howtos  ›  Servers  › 

Add ports on apache

Shulou Source: shulou.com Published: 2022-06-02 08:05:08 11月13日 Update

How to set up a new port in Apache

Environment:

Windows server 2008 R2, Apache, PHP5

Steps:

Create a directory and put an index.php in it.

Open the Apache\ conf\ httpd.conf file and make the following changes:

#

# Options FollowSymLinks

# AllowOverride None

# Order deny,allow

# Deny from all

#

The reason for commenting out the above code is that there is a Deny from all setting in it. If it is not commented out, there will be a 403 Forbidden error when accessing the site on the port.

Listening port

S

Open comments for the following two items:

LoadModule vhost_alias_module modules/mod_vhost_alias.so

Include conf/extra/httpd-vhosts.conf

Comment out the following

Open the conf/extra/httpd-vhosts.conf file and add the following code at the end of the file:

ServerAdmin aa@hotmail.com

DocumentRoot "C:/develop"

ServerName localhost

ErrorLog "logs/dummy-host2.localhost-error.log"

CustomLog "logs/dummy-host2.localhost-access.log" common

Restart Apache

Visit the site and you can see the content.

Note:

When you do your own test program, you don't have to establish a port. You can do it in the following three ways:

Multi-site:

NameVirtualHost *: 80

ServerName www.a.com

DocumentRoot www/one

ServerName www.b.com

DocumentRoot www/two

Multiple virtual directories:

Alias / test "E:\ www"

AllowOverride All

Options Indexes FollowSymLinks Includes

Order allow,deny

Allow from all

Multi-port

ServerName www.c.com

DocumentRoot www/newport

Tags: Port comment file site code content directory reason way time end step environment program error note test monitor Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Docker Microsoft MariaDB Linux