我最近使用Capistrano在我的Linux Redhat服务器上部署了一个Web应用程序,它在站点的文档根目录下创build以下目录结构:
/var/www/html/example.com/releases/* /var/www/html/example.com/current
为了加载页面加载当前目录,我改变了我的httpd.conf,以便example.com的DirectoryRoot被设置为/var/www/html/example.com/current 。 问题是,我想要某些目录可用于浏览“当前”目录(phpMyAdmin和Bugzilla)之外。 我已经尝试touch .htaccess文件到/var/www/html/example.com但没有创build…
为了访问位于DocumentRoot外部的目录,我需要做些什么? 我应该更改DocumentRoot并使用.htaccess将Web浏览器转发到当前目录,还是有更好的方法?
另外,作为一个不重要的方面问题:使用特定端口用于某些服务是否明智? 当我使用cPanel时,他们使用:2082和使用的WHM:2086。 我可以在我的服务器上做类似的事情,使服务(phpMyAdmin和Bugzilla)更隐藏一点吗?
您将要使用别名来访问当前DocumentRoot之外的目录。
Apache的configuration实际上是非常好的自我文档。 您可以使用/icons/的别名作为示例:
# Aliases: Add here as many aliases as you need (with no limit). The format is # Alias fakename realname # # Note that if you include a trailing / on fakename then the server will # require it to be present in the URL. So "/icons" isn't aliased in this # example, only "/icons/". If the fakename is slash-terminated, then the # realname must also be slash terminated, and if the fakename omits the # trailing slash, the realname must also omit it. # # We include the /icons/ alias for FancyIndexed directory listings. If you # do not use FancyIndexing, you may comment this out. # Alias /icons/ "/var/www/icons/" <Directory "/var/www/icons"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory>
另外,作为一个不重要的方面问题:使用特定端口用于某些服务是否明智? 当我使用cPanel时,他们使用:2082和使用的WHM:2086。 我可以在我的服务器上做类似的事情,使服务(phpMyAdmin和Bugzilla)更隐藏一点吗?
你可以,但这只是默默无闻的安全,你最好打赌是通过SSL提供服务,并要求用户名/密码组合。