nginx多站点配置问题
来源:互联网 发布:西安java程序员薪酬 编辑:程序博客网 时间:2024/05/17 02:42
在nginx的conf文件夹中创建一个vhost的文件夹
每个站点都可以配置一个conf的配置文件
文件内容具体如下
server{ listen 80; server_name xxx.example.com; root /data/www/xxx; //网页页面的位置地址 index index.php index.html index.htm; location /api/ { proxy_set_header Host $host; proxy_set_header Host $host; proxy_set_header X-Real-Ip $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://simlergray.cn:8080; //配置反向代理 }}
nginx.conf 配置
user nobody;worker_processes auto;error_log /var/log/nginx/error.log;pid /run/nginx.pid;events { worker_connections 1024;}http { 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 /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; client_max_body_size 6M; client_body_buffer_size 128K; include /etc/nginx/mime.types; default_type application/octet-stream; # Load modular configuration files from the /etc/nginx/conf.d directory. # See http://nginx.org/en/docs/ngx_core_module.html#include # for more information. #include /etc/nginx/conf.d/*.conf; # server { #listen 80 default_server; #listen [::]:80 default_server; #server_name _; #root /usr/share/nginx/html; # Load configuration files for the default server block. #include /etc/nginx/default.d/*.conf;# listen 80; # server_name localhost; # location / { # root /data/www/index; # index index.html index.htm;# } #error_page 404 /404.html; # location = /40x.html { #} #error_page 500 502 503 504 /50x.html; # location = /50x.html { #} # } include vhost/*.conf;}
配置完之后 还有最后一步,就是配置域名的解析,每一个二级域名都去绑定本服务器的ip地址,这是很重要的一个步骤,新手很容易忘记这一步,或者不知道这一步,很容易出现明明配置好了 nginx为什么无法请求成功的问题
阅读全文
0 0
- nginx多站点配置问题
- nginx多站点配置
- Nginx 多站点配置
- nginx多站点配置
- nginx 多站点配置
- Nginx多站点配置
- nginx配置多站点
- Nginx多站点配置
- nginx配置多站点
- nginx 配置多站点
- Wordpress 3 多站点配置子站点无法显示图片问题 , 附Nginx伪静态配置
- Nginx 的多站点配置
- Nginx 的多站点配置
- Nginx 的多站点配置
- Nginx 的多站点配置
- linux nginx多站点配置
- Nginx 的多站点配置
- nginx 多个站点配置
- 线性规划的python的pulp包
- 什么是Windows USB设备路径,它是如何格式化的?
- 欢迎使用CSDN-markdown编辑器
- 数据卷
- jquery easyui中获取下拉列表的值
- nginx多站点配置问题
- Spring应用的运行环境及属性配置综述
- oracle获取小于或等于当前时间行列
- maven-assembly-plugin总结
- 215. Kth Largest Element in an Array
- Tampermonkey(油猴子)安装使用+脚本分享
- 三十五年经验分享:程序员进阶八法
- 二维数组做函数的参数
- XML格式字符串转换成Map,包括List