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



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

我想向/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
  }
}    

为nginx设置两个"托管包"。一个监听owncloud的公共主机名,另一个监听内部主机名和/或内部ip。然后您可以通过http://the-host-name-you-have.chosen通过\SERVERNAME或您的内部IP(例如192.168.0.3 )访问您的wiki

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

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。

最新更新