1. Download and install
: http://httpd.apache.org/download.cgi
Installing Apache into a directory
Modify the Conf/http.conf file
Modify the configuration file port ( port number for your local project )
Modify configuration file Port 60 line: Listen 3000
Line 38th
Modify Apache directory and change to Apache installation path
Cases:
Define srvroot "D:/_tools/jee-oxygen/httpd-2.4.33-x64-vc11-r2/apache24"
Line No. 249
DocumentRoot "${srvroot}/htdocs"
<directory "${srvroot}/htdocs" >
Change the path to the code you want to test (the path to your own project)
Cases:
DocumentRoot "D:/gitpath/workspace/yangpuoa/src/main/webpage"
<directory "D:/gitpath/workspace/yangpuoa/src/main/webpage" >
Remove the # from the front of the next two lines
142 LoadModule Proxy_module modules/mod_proxy.so
LoadModule Proxy_http_module modules/mod_proxy_http.so
At the end add
<ifmodule mod_proxy.c>
#proxy setting
proxypass/examples/http://localhost:8080/examples/
proxypassreverse/examples/http://localhost:8080/examples/
</IfModule>
# Here is the configuration for the interface server you want to request
#API目录/examples/
#API地址 http://localhost:8080/examples/
Run cmd, go to the extracted Apache\bin directory, execute the following command
Installation Services
Httpd-k Install
Start stop Service
Httpd-krestart//restart
Httpd-k stop//Stop
--------------------------------------------------------
Reported 443 error, Avira related port
Netstat-ano | FINDSTR 443
tasklist | findstr ' PID '
taskkill/f/pid ' PID '
--------------------------------------------------
Use:
$ ("button"). Click (function () { $.ajax ({ URL: "Http://localhost:3000/examples/1.json", Type: "GET", dataType: "JSON", success:function (data) { console.log (data.name); }, error:function (err) { Console.log (err);}) })
Note Note Note: Here to write your local port + API directory is: http://localhost:3000/Examples/1.json ", automatic proxy to HTTP://LOCALHOST:8080/EXAMPLES/1. JSON
Apache Configure reverse proxy settings