pulpfunction 发表于 2021-5-16 16:53:29

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

/usr/local/nginx/conf/nginx.conf
userwww www;

worker_processes auto;
worker_cpu_affinity auto;

error_log/home/wwwlogs/nginx_error.logcrit;

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

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

events
    {
      use epoll;
      worker_connections 51200;
      multi_accept off;
      accept_mutex off;
    }

http
    {
      include       mime.types;
      default_typeapplication/octet-stream;

      server_names_hash_bucket_size 128;
      client_header_buffer_size 32k;
      large_client_header_buffers 4 32k;
      client_max_body_size 50m;

      sendfile on;
      sendfile_max_chunk 512k;
      tcp_nopush on;

      keepalive_timeout 60;

      tcp_nodelay on;

      fastcgi_connect_timeout 300;
      fastcgi_send_timeout 300;
      fastcgi_read_timeout 300;
      fastcgi_buffer_size 64k;
      fastcgi_buffers 4 64k;
      fastcgi_busy_buffers_size 128k;
      fastcgi_temp_file_write_size 256k;

      gzip on;
      gzip_min_length1k;
      gzip_buffers   4 16k;
      gzip_http_version 1.1;
      gzip_comp_level 2;
      gzip_types   text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss;
      gzip_vary on;
      gzip_proxied   expired no-cache no-store private auth;
      gzip_disable   "MSIE \.";

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

      server_tokens off;
      access_log off;

server
    {
      listen 80 default_server reuseport;
      #listen [::]:80 default_server ipv6only=on;
      server_name wprdpress;
      index index.html index.htm index.php;
      root/home/wwwroot/zblog.com;

      #error_page   404   /404.html;

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


      include enable-php.conf;

      location /nginx_status
      {
            stub_status on;
            access_log   off;
      }

      location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$


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


server
    {
      listen 80;
      #listen [::]:80;
      server_name zblog.com ;
      index index.html index.htm index.php default.html default.htm default.php;
      root/home/wwwroot/zblog.com;

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

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

      include enable-php-pathinfo.conf;

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

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

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

      location ~ /\.
      {
            deny all;
      }

      access_log off;
    }
~                  
这个好像管静态的

我想放多个网站就改第一个文件就行吧应该
排版很烂,见谅

流河旱树 发表于 2021-5-16 16:55:17

你再新建个conf不就行了嘛....

pulpfunction 发表于 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,这个里设置就行哇

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

a站是zblog,b站小说站

pulpfunction 发表于 2021-5-16 17:01:51

c站还打算弄个电影站,给单位放:lol

tsubasa 发表于 2021-5-16 17:11:04

pulpfunction 发表于 2021-5-16 17:12:12

tsubasa 发表于 2021-5-16 18:11
建议你把lnmp那个一键生成的nginx.conf中,63-104行的那个默认server删除掉。
所有配置读vhost里的文件,这 ...

好的 谢谢
页: [1]
查看完整版本: 求解答lnmp 俩个nginx配置的问题