Nginx入门 互动版

在线工具推荐: Three.js AI纹理开发包 - YOLO合成数据生成器 - GLTF/GLB在线编辑 - 3D模型格式在线转换 - 可编程3D场景编辑器

反向代理示例


  反向代理(Reverse Proxy)是指代理服务器来接收来自Internet上的连接请求,并将请求转发给内部网络上的服务器,并从服务器上得到的结果返回给Internet上请求连接的客户端。

  比如要配置后端跑 apache 服务的 ip 和端口,也就是说,我们的目标是实现通过 http://ip:port 能访问到你的网站。配置文件可以修改以下内容,reload nginx就可以了。

## Basic reverse proxy server ##
    upstream apachephp  {
        server ip:8080; #Apache
    }
    ## Start www.nowamagic.net ##
    server {
        listen 80;
        server_name  www.nowamagic.net;
        access_log  logs/quancha.access.log  main;
        error_log  logs/quancha.error.log;
        root   html;
        index  index.html index.htm index.php;

        ## send request back to apache ##
        location / {
            proxy_pass  http://apachephp;
                #……………………
}
}