日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

nginx配置多个php端口号,nginx如何设置多端口

發布時間:2025/3/21 php 54 豆豆
生活随笔 收集整理的這篇文章主要介紹了 nginx配置多个php端口号,nginx如何设置多端口 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

nginx如何設置多端口?

nginx設置多端口有兩種方法:

一、在server段寫上2個Listen就可以了.listen 192.168.0.15:808;

listen 192.168.0.15:8098;

如上,就可以同時監聽2個端口了.

二、在 nginx.conf 中配置多個個server即可user nginx nginx;

worker_processes 1;

worker_rlimit_nofile 65535;

events {

worker_connections 4000;

}

http {

include mime.types;

default_type application/octet-stream;

autoindex off;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '

'$status $body_bytes_sent "$http_referer" '

'"$http_user_agent" "$http_x_forwarded_for"'

'$upstream_addr $upstream_response_time $request_time ';

access_log logs/nginx/access.log main;

sendfile on;

keepalive_timeout 65;

upstream localhost {

server 127.0.0.1:8080 max_fails=7 fail_timeout=7s;

}

server {

listen 808;

server_name localhost;

large_client_header_buffers 4 128k;

client_max_body_size 300m;

client_body_buffer_size 128k;

proxy_connect_timeout 600;

proxy_read_timeout 600;

proxy_send_timeout 600;

proxy_buffer_size 64k;

proxy_buffers 4 32k;

proxy_busy_buffers_size 64k;

proxy_temp_file_write_size 64k;

#設定查看Nginx狀態的地址

location /nginxstatus{

stub_status on;

access_log on;

auth_basic "nginxstatus";

auth_basic_user_file htpasswd;

}

#ftpweb

location /ftpweb {

index index.html index.htm index.jsp;

proxy_pass http://192.168.0.16:9081/ftpweb;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header Host $host:$server_port;

}

#Zabbixweb

location /webzabbix/ {

index index.html index.htm index.jsp;

proxy_pass http://192.168.0.15/zabbix/;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header Host $host:$server_port;

}

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root html;

}

}

server {

listen 8098;

server_name localhost;

large_client_header_buffers 4 128k;

client_max_body_size 300m;

client_body_buffer_size 128k;

proxy_connect_timeout 600;

proxy_read_timeout 600;

proxy_send_timeout 600;

proxy_buffer_size 64k;

proxy_buffers 4 32k;

proxy_busy_buffers_size 64k;

proxy_temp_file_write_size 64k;

#開放8098接口地址

location /interserver {

index index.html index.htm index.jsp;

proxy_pass http://192.168.0.20:8812/interserver/;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header Host $host:$server_port;

}

}

}

這樣就就可以一個nginx服務訪問808和8098兩個端口到不同服務的了

http://192.168.0.15:808/ftpweb

http://192.168.0.15:8098/interserver

更多Nginx相關知識,請訪問Nginx使用教程欄目!

總結

以上是生活随笔為你收集整理的nginx配置多个php端口号,nginx如何设置多端口的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。