如何使用现有的nginx服务器将LionWiki仅服务于我的局域网?

如何使用现有的nginx服务器将LionWiki仅服务于我的局域网?,nginx,owncloud,Nginx,Owncloud,Owncloud已安装并正在我的网络上运行Nginx。我可以从局域网外访问自己的云。我只想在我的局域网上主持一次会议 我想在/etc/nginx/sites enabled/中添加一个新的配置文件,以便仅为本地网络上的特定目录提供服务 我的当前配置: $ cat /etc/nginx/sites-enabled/default # owncloud (ssl/tls) server { listen 443 ssl; server_name 192.168.1.10; ssl_ce

Owncloud已安装并正在我的网络上运行Nginx。我可以从局域网外访问自己的云。我只想在我的局域网上主持一次会议

我想在
/etc/nginx/sites enabled/
中添加一个新的配置文件,以便仅为本地网络上的特定目录提供服务

我的当前配置:

$ cat /etc/nginx/sites-enabled/default 
# owncloud (ssl/tls)
server {
  listen 443 ssl;
  server_name 192.168.1.10;
  ssl_certificate /etc/nginx/cert.pem;
  ssl_certificate_key /etc/nginx/cert.key;
  root /var/www;
  index index.php;
  client_max_body_size 1000M; # set maximum upload size
  fastcgi_buffers 64 4K;

  # deny direct access
  location ~ ^/owncloud/(data|config|\.ht|db_structure\.xml|README) {
    deny all;
  }

  # default try order
  location / {
    try_files $uri $uri/ index.php;
  }

  # owncloud WebDAV
  location @webdav {
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param HTTPS on;
    include fastcgi_params;
  }

  # enable php
  location ~ ^(?<script_name>.+?\.php)(?<path_info>/.*)?$ {
    try_files $script_name = 404;
    include fastcgi_params;
    fastcgi_param PATH_INFO $path_info;
    fastcgi_param HTTPS on;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_read_timeout 900s; # 15 minutes
  }
}    
$cat/etc/nginx/sites enabled/default
#owncloud(ssl/tls)
服务器{
听443ssl;
服务器名称192.168.1.10;
ssl_证书/etc/nginx/cert.pem;
ssl证书密钥/etc/nginx/cert.key;
root/var/www;
index.php;
客户端_最大_正文_大小1000M;#设置最大上传大小
fastcgi_缓冲器64 4K;
#拒绝直接访问
位置~^/owncloud/(数据|配置| \.ht |数据库结构\.xml |自述){
否认一切;
}
#默认尝试顺序
地点/{
尝试_文件$uri$uri/index.php;
}
#OwnCloudWebDAV
位置@webdav{
fastcgi_split_path_info^(.+\.php)(/.*);
fastcgi_pass 127.0.0.1:9000;
fastcgi\参数脚本\文件名$document\根$fastcgi\脚本\名称;
fastcgi_param HTTPS on;
包括fastcgi_参数;
}
#启用php
位置~^(?.+?\.php)(?/.*)${
try_files$script_name=404;
包括fastcgi_参数;
fastcgi_参数PATH_INFO$PATH_INFO;
fastcgi_param HTTPS on;
fastcgi_pass 127.0.0.1:9000;
fastcgi_读取超时900s;#15分钟
}
}    
为您的nginx设置设置两个“托管包”。一个侦听您自己云的公共主机名,另一个侦听内部主机名和/或内部ip。然后,您可以通过\SERVERNAME或您的内部IP访问您自己的云和wiki,例如192.168.0.3

然后,您的配置可能看起来有点像:

server {
            listen       80;
            server_name  SERVERNAME;

            access_log  logs/localhost.access.log  main;

            location / {
                root /var/www/lionwiki;
                index index.html index.htm index.php;
            }

            listen       80;
            server_name  public-host-name;

            access_log  logs/localhost.access.log  main;

            location / {
                root /var/www/owncloud;
                index index.html index.htm index.php;
            }
       }

注意:我不能100%确定该语法是否正确,我通常使用IIS

您当前的配置是什么?您可以将Nginx配置为侦听特定地址,还是必须侦听所有接口并仅拒绝特定路径的访问?您的网络是如何配置的?没有足够的信息按原样回答您的问题。