I'm in a situation where I'd like to have an nginx...
# lucee
a
I'm in a situation where I'd like to have an nginx front-end use SNI to send traffic to multiple Lucee sites. But I haven't found a great way to tell Tomcat and Lucee what to expect. • site-a.example.com and site-b.example.com both point to the same IP • nginx works out that it's thinking about site-a or site-b • I can have two different nginx server listeners, and these servers both proxy_pass to localhost:8888 -- how do I tell Lucee what site we're talking about?
I thought about having different listener ports for each Context but that's not how those work.
And I thought about having multiple Server blocks in Tomcat, each listening on a different port, but I'm not sure what'll happen if I mess with the administrator on one parallel site -- will the others notice?
I can't set them up as virtual Hosts because I'm addressing localhost, not site-a -- unless that actually gets passed through and I just don't understand that for some reason?
q
Not sure about nginx, but in Apache httpd, vhosts are used to route sites back to tomcat/lucee. SNI is only on the TLS side, and does not really matter.
a
So I can use the name I intend to use in the Tomcat virtual host and it just won't matter that it's proxy_passed to the same place?
I'll check that. I suppose I should've earlier, I just didn't think that'd work.
q
that's how it works in httpd. I don't do a ton in nginx, but I would imagine it works the same. vhosts config is based on the httpd header. SNI config is purely at the TLS level and petty much ignored as soon as the TLS handshake happens.
a
That’s how it can work in nginx too it’s just the host name being accessed
a
Got it, thanks, I was just overthinking this.
e
1. nginx and apache both can host multiple domains pointed at lucee instances. as for config: Your nginx file should be something like this proxy_set_header Host $http_host; 2. proxy_set_header X-Real-IP $remote_addr; 3. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 4. proxy_set_header X-Forwarded-Proto $scheme; 5. #populate the cgi.https variable with on or off based on map condition which must be specified in a http {} block 6. proxy_set_header https $cgi_https; 7. 8. 9. #add headers for mod_cfml to do its work 10. proxy_set_header X-Tomcat-DocRoot $document_root; 11. proxy_set_header X-ModCFML-SharedKey SHARED-KEY-HERE; 12. # For more info on $lucee_context, see http://www.modcfml.org/index.cfm/install/web-server-components/nginx-all-os/ 13. if ($lucee_context = false) { 14. set $lucee_context $document_root; 15. } 16. proxy_set_header X-Webserver-Context $lucee_context; 17. 18. 19. # Enable path_info - http://www.lucee.nl/post.cfm/enable-path-info-on-nginx-with-lucee-and-railo 20. set $pathinfo ""; 21. # if the extension .cfm or .cfc is found, followed by a slash and optional extra 22. if ($uri ~ "^(.+?\.cf[mc])(/.*)") {
your server server.xml should have something like this: _<!-- visit modcfml.org for details on mod_cfml configuration options -->_ <*Valve* className="mod_cfml.core" loggingEnabled="false" maxContexts="200" timeBetweenContexts="2000" scanClassPaths="false" sharedKey="somethingsomethingDarkside" />