tomcat/imooc.com.conf文件如下:
server {
listen 80;
autoindex on;
server_name tomcat.imooc.com;
access_log d:/access.log combined;
index index.html index.htm index.jsp index.php;
#error_page 404 /404.html;
if ( $query_string ~* “.[;’<>].” ){
return 404;
}
location / {
proxy_pass http://127.0.0.1:8080;
add_header Access-Control-Allow-Origin *;
}
}
hosts增加一行:
127.0.0.1 tomcat.imooc.com
访问结果如图: