如何在MacOS上获得干净的Java VM?(How to get a clean Java VM on MacOS?)
在MacOS上(至少在SnowLeopard上),java命令无条件地将一个额外的jar添加到类路径中:
/System/Library/Frameworks/JavaVM.framework/Versions/A/Resources/.compatibility/14compatibility.jar。
该jar包含一个未命名的Apache Xerces + Xalan版本。 这可能会导致尝试显式使用这些库的某些其他版本的应用程序的混乱结果,特别是在servlet容器中的webapps中。
我试图通过使用MacPorts中的OpenJDK来避免这种情况,但MacPorts构建失败。
有没有人制定了一些其他的配方,除了删除该JAR文件的明显暴力? 这是在一个博客上推荐的,但是我担心一些Apple组件或其他组件在没有它的情况下会失败。
On MacOS (at least on SnowLeopard), the java command unconditionally adds an extra jar to the classpath:
/System/Library/Frameworks/JavaVM.framework/Versions/A/Resources/.compatibility/14compatibility.jar.
This jar contains a version of Apache Xerces+Xalan, unrenamed. This can cause chaotic results for applications that are trying explicitly to use some other versions of these libraries, particularly in webapps in servlet containers.
I tried to avoid this by using OpenJDK from MacPorts, but the MacPorts build failed for it.
Has anyone worked out some other recipe, other than the obvious violence of deleting that JAR file? It's recommended on one blog, but I fear that some Apple component or another will fail without it.
原文:https://stackoverflow.com/questions/1731726
最满意答案
该文件可以存储在任何地方,真的。 不过,我建议不要把它放在任何可以在线访问的地方。 通常,我最终将它放在例如
/etc/nginx/.htpasswd
。如果你想保护整个事物,这些行不应该在位置块中,而应该放在服务器块中。 喜欢这个:
... stuff auth_basic "Restricted Content"; auth_basic_user_file /etc/nginx/.htpasswd; # FORGE CONFIG (DOT NOT REMOVE!) ... more stuff
该文件应由每个经过身份验证的用户使用一行代码组成,其中每行格式为
username:encrypted-password
。 生成.htpasswd有很多种方法,我通常只是google的东西,例如http://www.htaccesstools.com/htpasswd-generator/您也可以通过例如htpasswd实用程序创建它,但这是Apache服务器软件包的一部分,因此在您使用nginx时安装它是没有意义的。
The file can be stored anywhere, really. I recommend not putting it anywhere that's accessible online, though. Typically, I end up putting it in e.g.
/etc/nginx/.htpasswd
.The lines should not be in the location block but rather in the server block if you want to protect the entire thing. Like this:
... stuff auth_basic "Restricted Content"; auth_basic_user_file /etc/nginx/.htpasswd; # FORGE CONFIG (DOT NOT REMOVE!) ... more stuff
The file should consist of a single line for each authenticated user, where each line is in the format
username:encrypted-password
. There are many ways of generating the .htpasswd, I usually just google for something, e.g. http://www.htaccesstools.com/htpasswd-generator/You could also create it through e.g. the htpasswd utility, but that's part of an Apache server package so it makes little sense to install it when you're using nginx.
相关问答
更多-
Heureka,我自己想出来......或者我认为是解决方案。
ServerName my.domain DocumentRoot /var/sites/sitename/ ServerAdmin ... AuthUserFile /etc/apache2/.htpasswd AuthGroupFile /dev/null AuthNa ... -
在.htpasswd上添加用户(Adding a user on .htpasswd)[2023-11-09]
完全相同的事情,只是省略-c选项。 Apache的文档在这里 。 htpasswd /etc/apache2/.htpasswd newuser 此外, htpasswd通常不以root身份运行。 它通常由网络服务器或正在服务的文件的所有者拥有。 如果您使用root来编辑它而不是以这些用户身份登录,那么这是可以接受的(我想),但是您需要小心确保不要以root身份创建文件(因此有root拥有它,没有其他人能够编辑它)。 Exact same thing, just omit the -c option. Ap ... -
我有像这样的.htaccess文件: AuthUserFile /data/www/.../http-users AuthType Basic AuthName "private" require user cf 它有效。 你能做什么: 通过查看错误日志来检测可能的原因。 在许多情况下,即使在托管环境中也可以访问它 确保已设置AllowOverride AuthConfig 。 您无法在.htaccess设置它,您必须在服务器配置文件中进行设置。 在托管环境中,您必须询问您的托管服务提供商。 不太可能, ...
-
如果路径无效,您将收到500错误或其他内容。 由于浏览器提示输入密码,因此路径很可能正确。 但是,您需要确保正确生成htpasswd。 检查一下 - http://www.htaccesstools.com/htpasswd-generator/ If the path were invalid, you'd get a 500 error or something. Since the browser prompts for password, most likely the path is correc ...
-
htpasswd在所有子域上并通过不同的auth ip防止auth(htpasswd on all subdomains and prevent auth by different auth ip's)[2023-06-18]
我找到了大于或等于2.4的apache版本的解决方案AuthUserFile /home/www/.htpasswd AuthName "Acceso Privado" ... -
在codeigniter中.htpasswd(.htpasswd in codeigniter)[2022-11-10]
最后,解决方案如此简单... # password-protect single fileAuthName "my_controller" AuthType Basic AuthUserFile /home2/afolder/.htpasswds/.htpasswd require valid-user 刚刚删除.php,一切都很好... Finally the solution was as simple as that... # pass ... -
该文件可以存储在任何地方,真的。 不过,我建议不要把它放在任何可以在线访问的地方。 通常,我最终将它放在例如/etc/nginx/.htpasswd 。 如果你想保护整个事物,这些行不应该在位置块中,而应该放在服务器块中。 喜欢这个: ... stuff auth_basic "Restricted Content"; auth_basic_user_file /etc/nginx/.htpasswd; # FORGE CONFIG (DOT NOT REMOVE!) ... more stuff 该 ...
-
只需将.htaccess文件放在要密码保护的目录中即可。 它是一个每个目录的配置文件。 Just put the .htaccess file in the directory you want to password-protect. It is a per-directory config file.
-
好吧所以这个问题比我想象的要简单。 我正在使用不支持ssl的免费cloudflare dns指向。 我切换到使用namescheap dns,它开始工作。 okay so the problem was simpler than I thought. I was using the free cloudflare dns pointing which didn't support ssl. I switched to using the namescheap dns and it started worki ...
-
htaccess和htpasswd?(htaccess and htpasswd?)[2022-05-08]
看起来在AuthUserFile行中的目录和文件名之间有一个空格而不是斜杠。 Looks like there's a space instead of a slash between the directory and file name in the AuthUserFile line.