Ubuntu에 Railo와 Apache를 설치하고 기본 인증 사용자 이름을 Railo에 전달하려면 어떻게 해야 합니까?

Ubuntu에 Railo와 Apache를 설치하고 기본 인증 사용자 이름을 Railo에 전달하려면 어떻게 해야 합니까?

Adobe ColdFusion 사용에서 Railo 사용으로 전환하려고 합니다. 이전하려는 애플리케이션은 웹 서버가 기본 인증을 확인하도록 하는 데 의존하지만 변수를 사용하여 인증된 사용자의 사용자 이름을 알아야 합니다 #REMOTE_USER#.

cgi 범위 덤프를 시도했는데 변수가 설정되지 않은 것 같습니다. 나는 약 일주일 동안 이것을 새로운 방식으로 진행하려고 노력했고 막혔습니다.

답변1

그래서 마침내 알아냈습니다. 말했듯이, 이것을 얻는 데는 적어도 일주일이 걸렸습니다. 그래서 나는 이것을 위해 새로운 기계를 설정하는 방법에 대한 내 메모를 공유하고 있으므로 다른 누구도 이것을 알아내는 데 많은 시간을 소비하지 않아도 됩니다. 중요한 것은 HTTP 대신 AJP 프로토콜을 사용하여 Railo에 프록시를 사용하고 Tomcat에 인증을 수행할 필요가 없다고 알리려는 것입니다(이렇게 하면 변수를 그대로 통과할 수 있음).

시작하자:

apt-get install apache2 mysql-server apache2-utils
a2enmod proxy_ajp
service apache2 restart

.

레일로를 설치하세요:

다음 페이지에 나열된 표준 설치 프로그램 64비트 버전을 다운로드하세요.http://www.getrailo.org/index.cfm/download/.

실행 가능하게 만드세요:

chmod +x <file_you_just_downloaded>

실행하세요:

./<file_you_just_downloaded>

기본값을 모두 선택하세요.

.

좋아, 이제 다음과 같이 구성 파일을 편집하십시오.

=== modified file '/etc/apache2/apache2.conf'
--- /etc/apache2/apache2.conf 2014-10-10 00:22:11 +0000
+++ /etc/apache2/apache2.conf 2014-10-10 00:27:48 +0000
@@ -223,18 +223,24 @@
<IfModule mod_proxy.c>
<Proxy *>
Allow from 127.0.0.1
+
+ AuthType Basic
+ AuthName "Employee Login"
+ AuthBasicProvider file
+ AuthUserFile /etc/apache2/.htpasswd
+ Require valid-user
</Proxy>
ProxyPreserveHost On
- ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ http://127.0.0.1:8888/$1$2
- ProxyPassMatch ^/(.+\.cfchart)(/.*)?$ http://127.0.0.1:8888/$1$2
- ProxyPassMatch ^/(.+\.cfml)(/.*)?$ http://127.0.0.1:8888/$1$2
+ ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ ajp://127.0.0.1:8009/$1$2
+ ProxyPassMatch ^/(.+\.cfchart)(/.*)?$ ajp://127.0.0.1:8009/$1$2
+ ProxyPassMatch ^/(.+\.cfml)(/.*)?$ ajp://127.0.0.1:8009/$1$2
# optional mappings
#ProxyPassMatch ^/flex2gateway/(.*)$ http://127.0.0.1:8888/flex2gateway/$1
#ProxyPassMatch ^/messagebroker/(.*)$ http://127.0.0.1:8888/messagebroker/$1
#ProxyPassMatch ^/flashservices/gateway(.*)$ http://127.0.0.1:8888/flashservices/gateway$1
#ProxyPassMatch ^/openamf/gateway/(.*)$ http://127.0.0.1:8888/openamf/gateway/$1
#ProxyPassMatch ^/rest/(.*)$ http://127.0.0.1:8888/rest/$1
- ProxyPassReverse / http://127.0.0.1:8888/
+ ProxyPassReverse / ajp://127.0.0.1:8009/
</IfModule>



=== modified file '/etc/apache2/sites-available/000-default.conf'
--- /etc/apache2/sites-available/000-default.conf 2014-10-10 00:12:20 +0000
+++ /etc/apache2/sites-available/000-default.conf 2014-10-10 00:31:59 +0000
@@ -26,6 +26,13 @@
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
+ <Directory /var/www/html>
+ AuthType Basic
+ AuthName "Employee Login"
+ AuthBasicProvider file
+ AuthUserFile /etc/apache2/.htpasswd
+ Require valid-user
+ </Directory>
</VirtualHost>

htpasswd 프로그램을 사용하여 .htpasswd파일을 만듭니다. /etc/apache2일부 사이트는 인증되고 일부는 인증되지 않으려면 프록시 섹션을 가상 호스트 정의 안에 넣고 필요에 따라 가상 호스트별로 조정할 수 있습니다.

편집하다/opt/railo/tomcat/config/server.xml

=== modified file '/opt/railo/tomcat/config/server.xml'
--- /opt/railo/tomcat/config/server.xml 2014-10-10 00:34:48 +0000
+++ /opt/railo/tomcat/config/server.xml 2014-10-10 00:36:33 +0000
@@ -89,7 +89,7 @@
-->

<!-- Define an AJP 1.3 Connector on port 8009 -->
- <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
+ <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" tomcatAuthentication="false" />
+ <Connector port="8010" protocol="AJP/1.3" tomcatAuthentication="false" secure="true" scheme="https"/>

<!-- An Engine represents the entry point (within Catalina) that processes -->

Railo/Tomcat을 다시 시작합니다.

/opt/railo/railo_ctl restart

이제 Railo는 기본 인증 사용자 이름을 cgi.remote_user에 넣어야 합니다. 나는 그것을 복사하는 것을 localconfig/application.cfm의 #REMOTE_USER#에 넣어야 한다고 생각했습니다. 그러나 그것은 이미 같은 것 같습니다. 포트 8010의 두 번째 AJP 커넥터는 Apache의 SSL 지원 가상 호스트에서 프록시를 수행하기 위한 것입니다. 따라서 SSL이 활성화된 가상 호스트가 있는 경우 8009 대신 포트 8010으로 프록시합니다. 이렇게 하면 Railo는 실행 중인 ColdFusion이 SSL을 사용하고 있음을 알 수 있도록 변수를 설정합니다.

관련 정보