Nginx 다 중 키 프로필 설정 및 프로필 참조 범례
14115 단어 Nginx
nginx. conf 파일 설정 은 다음 과 같 습 니 다.
# nginx
#user nobody;
## nginx worker process , CPU
worker_processes 4;
## worker , "too many open files"
#worker_rlimit_nofile 100000
##
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
## pid
pid logs/nginx.pid;
events {
## ,select、poll、epoll
use epoll;
## ,
worker_connections 1024;
}
## http
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 , 1024Kb
gzip on;
gzip_min_length 1024;
server {
listen 8000;
server_name localhost;
location / {
root /mnt;
}
}
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#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;
#}
}
## !!!
include test—project/*.conf;
}
conf 폴 더 아래 test - project 폴 더 를 새로 만 든 다음 하위 설정 파일 xx. conf 를 안에 있 습 니 다.nginx. conf 파일 에 include 하위 설정 파일 을 사용 하면 됩 니 다.
test - project 의 하위 프로필 설정 은 다음 과 같 습 니 다.
## , test-backend , 。
# 【127.0.0.1:9002】
upstream test-backend {
server 127.0.0.1:9002;
}
## test-peoject
server {
##
listen 99;
##
server_name localhost;
##
charset utf-8;
##
access_log logs/test-peoject.access.log main;
##
#error_log logs/test-peoject.error.log main;
#
client_max_body_size 500m;
#
deny 192.53.163.212;
#【html/test-project】
index index.html;
root html/test-project;
##
location / {
try_files $uri $uri/ @router;
index index.html index.htm;
}
## VUE
location @router {
rewrite ^.*$ /index.html last;
}
##
location ~ ^(/static/) {
access_log off;
root html/test-project;
expires 7d;
}
## ,
location ~ ^(/static/).+\.(jpg|jpeg|gif|png)$ {
access_log off;
root html/test-project;
expires 15d;
}
##
proxy_pass_request_headers on;
##
proxy_set_header Host $host;
proxy_set_header X-Real_IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
## , test-backend( )
location /test-pro {
proxy_pass http://test-backend;
}
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
linux2에 nginx 설치설치 가능한 nginx를 확인하고, 해당 nginx를 설치한다. localhost 혹은 해당 ip로 접속을 하면 nginx 화면을 볼 수 있다....
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.