我是Apache noob用户,正在尝试自动将对http://.com/gitweb的请求重定向到https://.com/gitweb
我将以下内容设置为/etc/apache2/conf.d/gitweb
Alias /gitweb /usr/share/gitweb
<Directory /usr/share/gitweb>
Options FollowSymLinks +ExecCGI
AddHandler cgi-script .cgi
Redirect gitweb https://<myserver>.com/gitweb
SSLRequireSSL
</Directory>
但是我一直收到403禁止通知
Forbidden
You don't have permission to access /gitweb on this server.
Apache/2.2.22 (Ubuntu) Server at dndo-gamma Port 80
我不希望此服务器托管的所有目录都重定向;只希望重定向gitweb的请求。
My /etc/apache2/ its enabled/000- default与其默认值保持不变
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
文件/etc/apache2/sites enabled/ default -ssl在默认的ubuntu/apache2安装中也没有变化。
发布于 2013-02-12 01:30:38
我通常使用mod_rewrite
来完成这些任务:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteLog "/var/log/apache2/rewrite_log"
RewriteRule ^/gitweb/(.*) https://%{SERVER_NAME}/gitweb/%1 [R]
但这不是编程,而是服务器配置;您可以考虑在serverfault.com上提出这个问题
https://stackoverflow.com/questions/14817405
复制相似问题