全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 4883|回复: 5

求解答lnmp 俩个nginx配置的问题

[复制链接]
发表于 2021-5-16 16:53:29 | 显示全部楼层 |阅读模式
/usr/local/nginx/conf/nginx.conf
  1. user  www www;

  2. worker_processes auto;
  3. worker_cpu_affinity auto;

  4. error_log  /home/wwwlogs/nginx_error.log  crit;

  5. pid        /usr/local/nginx/logs/nginx.pid;

  6. #Specifies the value for maximum file descriptors that can be opened by this process.
  7. worker_rlimit_nofile 51200;

  8. events
  9.     {
  10.         use epoll;
  11.         worker_connections 51200;
  12.         multi_accept off;
  13.         accept_mutex off;
  14.     }

  15. http
  16.     {
  17.         include       mime.types;
  18.         default_type  application/octet-stream;

  19.         server_names_hash_bucket_size 128;
  20.         client_header_buffer_size 32k;
  21.         large_client_header_buffers 4 32k;
  22.         client_max_body_size 50m;

  23.         sendfile on;
  24.         sendfile_max_chunk 512k;
  25.         tcp_nopush on;

  26.         keepalive_timeout 60;

  27.         tcp_nodelay on;

  28.         fastcgi_connect_timeout 300;
  29.         fastcgi_send_timeout 300;
  30.         fastcgi_read_timeout 300;
  31.         fastcgi_buffer_size 64k;
  32.         fastcgi_buffers 4 64k;
  33.         fastcgi_busy_buffers_size 128k;
  34.         fastcgi_temp_file_write_size 256k;

  35.         gzip on;
  36.         gzip_min_length  1k;
  37.         gzip_buffers     4 16k;
  38.         gzip_http_version 1.1;
  39.         gzip_comp_level 2;
  40.         gzip_types     text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss;
  41.         gzip_vary on;
  42.         gzip_proxied   expired no-cache no-store private auth;
  43.         gzip_disable   "MSIE [1-6]\.";

  44.         #limit_conn_zone $binary_remote_addr zone=perip:10m;
  45.         ##If enable limit_conn_zone,add "limit_conn perip 10;" to server section.

  46.         server_tokens off;
  47.         access_log off;

  48. server
  49.     {
  50.         listen 80 default_server reuseport;
  51.         #listen [::]:80 default_server ipv6only=on;
  52.         server_name wprdpress;
  53.         index index.html index.htm index.php;
  54.         root  /home/wwwroot/zblog.com;

  55.         #error_page   404   /404.html;

  56.         # Deny access to PHP files in specific directory
  57.         #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }


  58.         include enable-php.conf;

  59.         location /nginx_status
  60.         {
  61.             stub_status on;
  62.             access_log   off;
  63.         }

  64.         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
复制代码



/usr/local/nginx/conf/vhost/域名.conf


  1. server
  2.     {
  3.         listen 80;
  4.         #listen [::]:80;
  5.         server_name zblog.com ;
  6.         index index.html index.htm index.php default.html default.htm default.php;
  7.         root  /home/wwwroot/zblog.com;

  8.         include rewrite/other.conf;
  9.         #error_page   404   /404.html;

  10.         # Deny access to PHP files in specific directory
  11.         #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

  12.         include enable-php-pathinfo.conf;

  13.         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  14.         {
  15.             expires      30d;
  16.         }

  17.         location ~ .*\.(js|css)?$
  18.         {
  19.             expires      12h;
  20.         }

  21.         location ~ /.well-known {
  22.             allow all;
  23.         }

  24.         location ~ /\.
  25.         {
  26.             deny all;
  27.         }

  28.         access_log off;
  29.     }
  30. ~                    
复制代码

这个好像管静态的

我想放多个网站就改第一个文件就行吧应该
排版很烂,见谅
发表于 2021-5-16 16:55:17 | 显示全部楼层
你再新建个conf不就行了嘛....
 楼主| 发表于 2021-5-16 16:59:40 | 显示全部楼层
流河旱树 发表于 2021-5-16 17:55
你再新建个conf不就行了嘛....

我用lnmp建会再生成一个/usr/local/nginx/conf/vhost/域名b.conf

我意思是这种情况在第一个/usr/local/nginx/conf/nginx.conf,这个里设置就行哇

问题是不会啊一个内网机器,我想在a网站里点击,能跳转到另一个网站b

a站是zblog,b站小说站
 楼主| 发表于 2021-5-16 17:01:51 | 显示全部楼层
c站还打算弄个电影站,给单位放
发表于 2021-5-16 17:11:04 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
 楼主| 发表于 2021-5-16 17:12:12 | 显示全部楼层
tsubasa 发表于 2021-5-16 18:11
建议你把lnmp那个一键生成的nginx.conf中,63-104行的那个默认server删除掉。
所有配置读vhost里的文件,这 ...

好的 谢谢
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-4-26 11:23 , Processed in 0.071926 second(s), 8 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表