Home>

Since cross-domain requests are used in learning,So have to add multi-site services in the wamp integration environment.This article mainly introduces the use of multi-port access under wampserver.

Because cross-domain requests are used in learning,So have to add multi-site services in the wamp integration environment.

1. First you need to make sure that wamp is installed correctly.

2. Then find the httpd.conf file of apache2 in the installation directory of wamp. Make a copy of the file,Rename it to httpd2.conf (optional) and save it in the conf folder (along with httpd.conf).

Modify the code of httpd2.conf:

//from
listen 80
servername localhost:80
documentroot "c:/wamp/www /"
<directory "c:/wamp/www /">
//to
listen 8080 //The newly listened port of the apache service,Can be modified according to your needs
servername localhost:8080
documentroot "c:/wamp/www2 /" //www2 is the directory for our second website,Parallel to www
<directory "c:/wamp/www2 /">

3. Then create a new folder named www2 under c:/wamp.

4. The last step is the installation service.Write a bat file and run it directly.document content:

cd/d c:\ wamp \ bin \ apache \ apache2.2.21 \ bin
httpd.exe -k install -n "www2" -f "c:\ wamp \ bin \ apache \ apache2.2.21 \ conf \ httpd2.conf"

Or you can type commands in the command line,First enter the bin directory shown above, and then copy the next line (note that the specific directory is consistent with your actual).

The service is installed!

Casually write an index.html file in the www2 directory:

<button>this is a button</button>

Notice:

But this process may not be so smooth.

For example, when installing the service, an error may be reported:

Search engines are a good thing,A search of the error,With:

It turned out that the software conflicted with Windows 7's "User Account Control" (uac) when the software was installed, as long as you close uac first (Control Panel-User Accounts and Home Security-System and Security-Operation Center,There is "Change User Account Control Settings", changed to never notify,After completion, you will be prompted to restart.You need to restart at this time) and then install it.After installation can be modified back.

Then if it doesn't work,But the service is installed correctly,It may be that the service is not turned on.Open the service center and start the service (net start www2 from the command line)

ps:tomcat configure multi-port access

Application scenario:When a server can only access the above application through ip,We have multiple javaweb applications to be placed on one server,How to do?

Step 1:Configure multiple ports in tomcat's conf/server.xml, as follows:

<?xml version="1.0"?>
<!-Application 1, port="8080"->
<service name="catalina">
 <connector connectiontimeout="20000" port="8080" protocol="http/1.1" redirectport="8443" />
 <connector port="8009" protocol="ajp/1.3" redirectport="8443" />
 <engine defaulthost="localhost" name="catalina">
  <host appbase="webapps" autodeploy="true" name="localhost" unpackwars="true" xmlnamespaceaware="false" xmlvalidation="false">
   <context path="" docbase="d:\ root \ Project 1 root path \" reloadable="true" workdir="d:\ whtjroot \ Project 1 root path \ work" />
  </host>
 </engine>
</service>
<!-Application 2, port port="8090"->
<service name="catalina2">
 <connector connectiontimeout="20000" port="8090" protocol="http/1.1" redirectport="8443" />
 <connector port="8009" protocol="ajp/1.3" redirectport="8443" />
 <engine defaulthost="localhost" name="catalina2">
  <host appbase="webapps" autodeploy="true" name="localhost" unpackwars="true" xmlnamespaceaware="false" xmlvalidation="false">
   <context path="" docbase="d:\ root \ Project 2 root path \" reloadable="true" workdir="d:\ whtjroot \ Project 2 root path \ work" />
  </host>
 </engine>
</service>

Step 2:Open a port in the server

Control Panel —>Firewall —>Advanced Settings —>Inbound Rules —>New Rule —>

Port —>Enter the open port number

Precautions

Domain name exists,Then no need to use this method

This method is accessed through ip + port number

If the root is not occupied in tomcat,Then you can configure the virtual path to access the application

  • Previous Introduction to ASP Basics Part 2 (ASP Basics)
  • Next How the GridView control displays the sequence number