关于Nginx的基础理解,淘宝的文档已经介绍很清楚了:http://tengine.taobao.org/book/
以下记录些具体的使用流程,方便日后查看。
一. 整体配置步骤:
<p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"> </code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span>worker_processes 2;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"> </code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span>events {</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> worker_connections 1024;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span>}</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"> </code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span>http {</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> server_tokens off;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span></span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> include mime.types;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> default_type application/octet-stream;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span></span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> charset utf-8; </span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"> </code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> server_names_hash_bucket_size 128;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> client_header_buffer_size 32k;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> large_client_header_buffers 4 32k;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> client_max_body_size 300m;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> tcp_nopush on;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> tcp_nodelay on;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> client_body_buffer_size 512k;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> proxy_connect_timeout 300s;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> proxy_read_timeout 300s;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> proxy_send_timeout 300s;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> proxy_buffer_size 64k;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> proxy_buffers 4 32k;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> proxy_busy_buffers_size 64k;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> proxy_temp_file_write_size 128k;</span></code></p>
<div class="aritcle_card">
<a class="aritcle_card_img" href="/ai/1584">
<img src="https://img.php.cn/upload/ai_manual/000/000/000/175680266797527.png" alt="钉钉 AI 助理">
</a>
<div class="aritcle_card_info">
<a href="/ai/1584">钉钉 AI 助理</a>
<p>钉钉AI助理汇集了钉钉AI产品能力,帮助企业迈入智能新时代。</p>
<div class="">
<img src="/static/images/card_xiazai.png" alt="钉钉 AI 助理">
<span>21</span>
</div>
</div>
<a href="/ai/1584" class="aritcle_card_btn">
<span>查看详情</span>
<img src="/static/images/cardxiayige-3.png" alt="钉钉 AI 助理">
</a>
</div>
<p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> proxy_ignore_client_abort on; </span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> gzip on;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> gzip_http_version 1.1;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> gzip_min_length 1k;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> gzip_buffers 4 16k;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> gzip_types text/plain application/x-javascript text/css application/xml; </span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> gzip_comp_level 2;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> gzip_vary on;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"> </code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> log_format main '$remote_addr - $remote_user [$time_local] "$request" '</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> '$status $body_bytes_sent "$http_referer" '</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> '"$http_user_agent" "$http_x_forwarded_for"';</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"> </code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> upstream apm {</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> server 192.168.199.157:8081;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> }</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span></span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> server {</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> listen 8080;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> server_name 192.168.199.176;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> charset utf-8;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> location /springmvc/ {</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> proxy_pass http://apm;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> }</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> }</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"> </code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> sendfile on;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span> keepalive_timeout 65;</span></code></p><p><codeLiberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span>}</span></code></p></p>版权声明:本文为博主原创文章,未经博主允许不得转载。
以上就介绍了Nginx 反向代理 Demo,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号