Ngnxは、サービス上の静的ファイル(HTML、画像など)をHTIPを介してブラウザクライアントに返すことができるHTP Webサーバーです。
server { listen 80; #port number location / { root / opt / www /;#static file path } }
ケース1:
1.1静的Webサイトページを/ opt / static /ディレクトリにアップロードします
1.2構成ファイルを開いて、静的Webサイトのルートディレクトリを指定します
ルール:ip + port == root
http://192.168.95.8:80/ = root = / opt / static / heal
http://192.168.95.8:80/heal/にアクセス
または
1.3 nginxサービスを再起動します。
./nginx -s reloadまたは/ usr / local / nginx / sbin / nginx -s reload
1.4構成ファイルが正しいかどうかをテストします。
/ usr / local / nginx / sbin / nginx -c /usr/local/nginx/conf/nginx.conf -t
1.5アクセステスト:http : //192.168.95.8