htaccess 具有多个命令?

发布于 2024-09-18 03:30:20 字数 615 浏览 0 评论 0原文

我目前正在尝试为我的一些客户提供一些上传功能,以便他们可以轻松地将较大的文件上传到我的服务器上。 创建了一个子域 uploads.mywebsite.com (链接到 /uploads),

因此,我在这个 /uploads 中

AuthType Basic
AuthName "Uploads to mysite"
AuthUserFile /home/.sites/74/site484/web/.htpasswd
Require valid-user

我有一个 .htaccess 文件,它要求提供一个可以正常工作的 userpasswd,但是现在我想在此 htaccess 文件中添加另一行。

suPHP_ConfigPath /home/.sites/74/site484/web/stf/uploads/

一旦我添加这个,我就会收到内部服务器错误。

只是为了让您知道我想添加此行以链接到我的 /uploads 文件夹内的自定义 php.ini 文件,以确保 max_filesize 等设置为更高的值。

有什么想法我做错了吗?或者为什么我不能将这一行添加到 htaccess 文件而不导致错误?

问候马特

i'm currently trying to do a little upload-feature for some of my clients, so that they can easily upload larger files onto my server.
therefore i did a subdomain uploads.mywebsite.com (which links to /uploads)

inside of this /uploads i have an .htaccess file which asks for a userpasswd

AuthType Basic
AuthName "Uploads to mysite"
AuthUserFile /home/.sites/74/site484/web/.htpasswd
Require valid-user

that works fine, however now i want to add another line in this htaccess file.

suPHP_ConfigPath /home/.sites/74/site484/web/stf/uploads/

as soon as i add this i get an INTERNAL SERVER ERROR.

just so you know i want to add this line to link to a custom php.ini file inside of my /uploads folder to ensure max_filesize etc. is set to a higher value.

any ideas what i'm doing wrong? or why i can't add this line to the htaccess file without causing an error?

regards matt

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

旧城空念 2024-09-25 03:30:20

您确定使用的是 suExec PHP 吗?如果它只是最大文件大小指令,那么为什么不简单地将:

php_value upload_max_filesize 100M

放在 .htaccess 中?

Are you sure you're using suExec PHP? If it's just maximum filesize directive, then why not simply put:

php_value upload_max_filesize 100M

in your .htaccess?

千秋岁 2024-09-25 03:30:20

我可能是错的,但某些主机会配置 suPHP 以限制脚本在具有 777 或 666 权限的文件上运行。基本上,由于您将以自己的用户身份运行这些脚本(而不是通常运行 PHP 脚本的 Web 组用户,该用户的权限有限),因此将使用这些权限运行的脚本公开到 Internet 可能存在安全风险。尝试将文件权限更改为 755(rwx、rx、rx)或 644(rw、r、r)。

另外值得检查的是:确保涉及的所有文件/文件夹都有一个所有者(没有“nobody”所有权),并确保您没有在 .htacces 文件中使用“php_value”或“php_flag”(它不会出现)根据您的描述,情况如此)。

I may be mistaken, but certain hosts will configure suPHP to limit scripts from running on files with 777 or 666 permissions. Basically, since you'd be running these scripts as your own user (rather than the web group user that usually runs PHP scripts, which has limited rights), it is potentially a security risk to expose scripts running with those permissions to the internet. Try changing your file permissions to 755 (rwx, rx, rx) or 644 (rw, r, r).

Also worth checking: Make sure all files/folders involved have an owner (do not have "nobody" ownership), and make sure you don't use "php_value" or "php_flag" in your .htacces file (which doesn't appear to be the case, by your description).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文