最初に構成ファイルを変更します:
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 9922; server_name firstproxyserver; #charset koi8-r; #access_log logs/host.access.log main; #location / { #root html; #index index.html index.htm; #} location / { proxy_pass http://localhost:8989; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the php scripts to apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the php scripts to fastcgi server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param script_filename /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } server { listen 9977; server_name secondproxyserver; #charset koi8-r; #access_log logs/host.access.log main; #location / { #root html; #index index.html index.htm; #} location / { proxy_pass http://localhost:8080; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the php scripts to apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the php scripts to fastcgi server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param script_filename /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # another virtual host using mix of ip-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # https server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:ssl:1m; # ssl_session_timeout 5m; # ssl_ciphers high:!anull:!md5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }
重要なことは、サーバーが 2 つあり、各サーバーが異なるプロキシ サーバーに対応するということです。これにより、nginx が複数のサーバーをプロキシするという目的が達成されます。
以下は 2 つのサービス サーバーの構成です:
server { listen 9922; server_name firstproxyserver; #charset koi8-r; #access_log logs/host.access.log main; #location / { #root html; #index index.html index.htm; #} location / { proxy_pass http://localhost:8989; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the php scripts to apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the php scripts to fastcgi server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param script_filename /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } server { listen 9977; server_name secondproxyserver; #charset koi8-r; #access_log logs/host.access.log main; #location / { #root html; #index index.html index.htm; #} location / { proxy_pass http://localhost:8080; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the php scripts to apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the php scripts to fastcgi server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param script_filename /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} }
以下はテスト結果です:
最初に 2 つの Tomcat をデプロイしますサーバー:
以上がnginx を使用して複数のサーバーをプロキシする方法の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

Nginxは、高い並行性と低リソース消費シナリオに適していますが、Apacheは複雑な構成と機能的拡張を必要とするシナリオに適しています。 1.Nginxは、高性能と多数の同時接続を処理することで知られています。 2。Apacheは、その安定性とリッチモジュールのサポートで知られています。選択するときは、特定のニーズに基づいて決定する必要があります。

nginxisentialformodernwebapplicationsdueToitsRolesasareverseproxy、loadbalancer、andwebserver、weberporformanceandscalability.1)itactsasaReverseproxy、拡張、およびパフォーマンスを強化し、パフォーマンスを強化し、積極的に積極的なものを増やします

NGINXを通じてWebサイトのセキュリティを確保するには、次の手順が必要です。1。基本的な構成を作成し、SSL証明書と秘密鍵を指定します。 2。構成を最適化し、HTTP/2を有効にし、OCSPSTAPLING。 3.証明書パスや暗号化スイートの問題などの一般的なエラーをデバッグします。 4。let'sencryptの使用やセッションの多重化など、アプリケーションのパフォーマンス最適化の提案。

Nginxは、高性能のHTTPおよびリバースプロキシサーバーであり、高い並行接続の取り扱いに優れています。 1)基本的な構成:ポートを聞いて静的ファイルサービスを提供します。 2)高度な構成:逆プロキシとロードバランシングを実装します。 3)デバッグスキル:エラーログを確認し、構成ファイルをテストします。 4)パフォーマンスの最適化:GZIP圧縮を有効にし、キャッシュポリシーを調整します。

Nginxキャッシュは、次の手順を通じてWebサイトのパフォーマンスを大幅に改善できます。1)キャッシュ領域を定義し、キャッシュパスを設定します。 2)キャッシュ有効期間を構成します。 3)異なるコンテンツに従って異なるキャッシュポリシーを設定します。 4)キャッシュストレージと負荷分散を最適化します。 5)キャッシュ効果を監視およびデバッグします。これらの方法により、Nginxキャッシュはバックエンドサーバーの圧力を軽減し、応答速度とユーザーエクスペリエンスを向上させることができます。

DockerComposeを使用すると、Nginxの展開と管理が簡素化され、DockerswarmまたはKubernetesをスケーリングすることは一般的な慣行です。 1)DockerComposeを使用してNginxコンテナを定義および実行する、2)DockerswarmまたはKubernetesを介してクラスター管理と自動スケーリングを実装します。

nginxの高度な構成は、サーバーブロックとリバースプロキシを介して実装できます。1。サーバーブロックにより、複数のWebサイトを1つの場合に実行することができます。各ブロックは個別に構成されます。 2.逆プロキシは、リクエストをバックエンドサーバーに転送して、負荷分散とキャッシュアクセラレーションを実現します。

NGINXのパフォーマンスチューニングは、ワーカープロセスの数、接続プールサイズの数、GZIP圧縮とHTTP/2プロトコルの有効化、およびキャッシュとロードバランスを使用することで実現できます。 1.ワーカープロセスの数と接続プールサイズを調整します:worker_processesauto;イベント{worker_connections1024;}。 2。GZIP圧縮とhttp/2プロトコルを有効にします:http {gzipon; server {risten43sslhttp2;}}。 3。キャッシュ最適化:http {proxy_cache_path/path/to/cachelevels = 1:2k


ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

AI Hentai Generator
AIヘンタイを無料で生成します。

人気の記事

ホットツール

SublimeText3 Mac版
神レベルのコード編集ソフト(SublimeText3)

DVWA
Damn Vulnerable Web App (DVWA) は、非常に脆弱な PHP/MySQL Web アプリケーションです。その主な目的は、セキュリティ専門家が法的環境でスキルとツールをテストするのに役立ち、Web 開発者が Web アプリケーションを保護するプロセスをより深く理解できるようにし、教師/生徒が教室環境で Web アプリケーションを教え/学習できるようにすることです。安全。 DVWA の目標は、シンプルでわかりやすいインターフェイスを通じて、さまざまな難易度で最も一般的な Web 脆弱性のいくつかを実践することです。このソフトウェアは、

SublimeText3 中国語版
中国語版、とても使いやすい

mPDF
mPDF は、UTF-8 でエンコードされた HTML から PDF ファイルを生成できる PHP ライブラリです。オリジナルの作者である Ian Back は、Web サイトから「オンザフライ」で PDF ファイルを出力し、さまざまな言語を処理するために mPDF を作成しました。 HTML2FPDF などのオリジナルのスクリプトよりも遅く、Unicode フォントを使用すると生成されるファイルが大きくなりますが、CSS スタイルなどをサポートし、多くの機能強化が施されています。 RTL (アラビア語とヘブライ語) や CJK (中国語、日本語、韓国語) を含むほぼすべての言語をサポートします。ネストされたブロックレベル要素 (P、DIV など) をサポートします。

EditPlus 中国語クラック版
サイズが小さく、構文の強調表示、コード プロンプト機能はサポートされていません
