I'm having trouble setting Lucce to run on Apache in a CentOS 9 machine.
The steps I've followed are bellow:
Installed .run file from https://downloads.lucee.org
Left the default for apachectl, httpd conf and http modules (I've already checked and it seems they're correct, I can provide the values if you need)
Set Tomcat to run on port 8888, the default value (tomcat is in fact running because i can access it externally)
Accepted to install Apache connector
Accepted to install mod_cfml
Then, when Lucee is being installed, I get a post-install step error, mentioning that the installation may not complete correctly:
Error running /opt/lucee/sys/install_mod_proxy.sh -m install -t 8888 -f
/etc/httpd/conf/httpd.conf -c /usr/sbin/apachectl: apachectl: The "-M" option is
not supported.
apachectl: The "-M" option is not supported.
But the installation process ends and everything seems to be fine.
Tomcat is running (I can access through domain.com:8888)
Proxy is added to httpd.conf file with the following rules
<IfModule mod_proxy.c>
ProxyPreserveHost On
ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ http://127.0.0.1:8888/$1$2
ProxyPassMatch ^/(.+\.cfml)(/.*)?$ http://127.0.0.1:8888/$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/
</IfModule>
mod_cfml is loaded in httpd.conf file
LoadModule modcfml_module modules/mod_cfml.so
CFMLHandlers ".cfm .cfc .cfml"
ModCFML_SharedKey "{{ shared_key_here }}"
LogHeaders false
LogHandlers false
LogAliases false
VDirHeader false
In the end I restarted Lucee and Apache services and created a index.cfm file in /var/www/html, but when I try o access it I get a 503 error.
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
Catalina.out logs from tomcat and error_logs from apache dont give me any hints on whats happerning.
Can anyone point me any direction to solve this?
Any additional info you may need in order to help me fell free to ask.
Thanks.
So I found that my machine had SE (Security Enhanced) enabled, and there was a setting that prevented the request to be correctly proxied to tomcat, which is httpd_can_network_connect.
I had to run /usr/sbin/setsebool httpd_can_network_connect true in order to make it work, after this and restarting httpd service, everything was ok!
I have the following host file entries on Ubuntu 14 machine running apache
127.0.0.1 localhost
10.20.32.20 library.myDNSname.org
10.20.32.20 library-intra.myDNSname.org
10.20.32.20 mtf
And also
sudo a2ensite library
sudo a2ensite mtf
sudo service apache2 restart
Now when I browse the site.. I can only access library.myDNSname.org page.
But When I
a2dissite library
I can access the mtf site.
Please note both site has been added to the sites-available.
Any Idea how I might run both site on the same server?
Thanks for input
I think it would have been more helpful if you had included your apache sites configuration and also how you are accessing your site (whether by ip or hostname).
If you are accessing your site by an ip then it will just select the default vhost which is the first vhost definition in the configuration file. For more info you can check out Apache's doc.
Please try to access the sites with hostnames and post errors in comments when you tried to access mtf site for the first time.
i'm trying to install a apache2 on ubuntu 14.04 with mod_suexec and php5-fpm. What i want is, that the php scripts are running as the user and group that i've set in the fpm pool.conf for the virtual host. but it already runs as www-data. the tutorials i've found just explain how to setup php fpm on listening on a port with ProxyPassMatch or on a socket, but not explaining why or how to run it as an alternative user.
i've read that apache 2.4 in the ubuntu 14.04 packages could only run with the port listening fpm method, but how could i solve it on that way to run scripts with different pool configurations an run under the user set in the pool conf?
thanks a lot
Resolved it by setting each pool for a user with different Port listening on.
After that RegexProxyPassMatch in the vhost includes the port.
To get unique port numbers i'm calculating with the user UID like this in a bash script
BASEPORT=20000
USRID=`id -u $1`
NEWPORT=`echo $((USRID+BASEPORT))`
and write it into the pool and vhost conf.
thats all
I want to setup phpmyadmin for multi vhost users like.
example.tld_01/phpmyadmin
example.tld_02/phpmyadmin
NOTE: All apache vhost users and php script are chroot'ed for /var/www/html/[web_dir] through PHP-FPM + mod_proxy_fcgi
Try 01 => symbolic link:
ln -s /usr/share/phpmyadmin/* /var/www/html/[web_dir]/phpmyadmin
Problem 01:
Since php is chrooted users will not be able to access symbolic link of phpmyadmin
Try 02 => mount --bind:
mount --bind /usr/share/phpmyadmin/* /var/www/html/[web_dir]/phpmyadmin
Problem 02:
phpmyadmin has got some symbolic linked files in its libraries like "php-gettext/gettext.inc".
So getting this error.
Fatal error: require_once(): Failed opening required './libraries/php-gettext/gettext.inc' (include_path='.:/usr/share/php:/usr/share/pear')
Questions:
What is the best scenario in shared hosting to setup phpmyadmin for multi vhost and its users?
If you have used shared hosting, you wont see any folder like phpmyadmin in your account. But still you can access phpmyadmin. How is this possible?
About your overall problem, have you thought about using TCP/IP networking instead of sockets?
About your problem 02, that must be how your distribution has chosen to package their version of phpMyAdmin -- the official phpMyAdmin source does not have a symlink as you describe.
Try to use mod_alias
In this case for every VirtualHost you will be able to point to same directory like:
<Virtualhost tld1:80>
DocumentRoot /var/www/html/tld1/
Alias /phpmyadmin /usr/share/phpmyadmin
</virtualHost>
<Virtualhost tld2:80>
DocumentRoot /var/www/html/tld2/
Alias /phpmyadmin /usr/share/phpmyadmin
</virtualHost>
Should works good in your case. And it is an answer to both of your questions! :)
I have to put nodejs in port 80, but apache is already using it. How can I put both (nodejs and apache) on the same port 80? I need it because in my university all the ports are blocked except for PORT 80. (This is a realtime application with nodejs and socket.io (websockets) and in the other side a php application).
Thanks a lot
I do this via node.js proxy..
Install http-proxy with npm or official page
Example:
var http = require('http'),
httpProxy = require('http-proxy'),
proxyServer = httpProxy.createServer ({
hostnameOnly: true,
router: {
'domain.com': '127.0.0.1:81',
'domain.co.uk': '127.0.0.1:82',
'127.0.0.1': '127.0.0.1:83'
}
});
proxyServer.listen(80);
This creates a node process listening to port 80, and forwarding requests for domains which go to :81,82,83 etc. I recommend running this with forever and adding an entry to init.d so your proxy is up in case system shuts down.
You can also use Apache 2's mod_proxy and mod_proxy_http, which might be more reliable or perform better depending on your system.
Here's an example:
Firstly run below command to proxy to allow
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_balancer
sudo a2enmod proxy_balancer
sudo a2enmod lbmethod_byrequests
# Use Apache for requests to http://example.com/
# but use Node.js for requests to http://example.com/node/
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/example/
<Location /node>
ProxyPass http://127.0.0.1:8124/
ProxyPassReverse http://127.0.0.1:8124/
</Location>
</VirtualHost>
And of course you can modify the directives to your needs, such as using a different port for your virtual host (e.g., 443), different port for Node.js, or set up the proxy under a different block, such as for a subdomain (e.g., node.example.com).
I've personally done this the other way round from #liammclennan. Some suggest that proxying through Apache defeats some of the performance and scalability advantages of Node (don't have experience myself as my server doesn't get that much traffic, but from #liammclennan's link: "Every request that comes in through Apache will cause an Apache thread to wait/block until the response is returned from your Node.js process.", which obviously doesn't mesh well with Node's architecture.)
I used node-http-proxy to set up a Node proxy server roughly as described in the first link (my Node proxy runs on port 80; Apache and my other Node services don't). Seems to be working well so far, though I have had occasional stability problems that I've 'solved' through checking the proxy's still running with a cron job (edit: it seems a lot more stable these days). The proxy's pretty lightweight, taking up about 30MB memory.
You can't. You have to run node.js on another port and then proxy requests through apache. You can do this using mod_proxy
http://davybrion.com/blog/2012/01/hosting-a-node-js-site-through-apache/
I usually use haproxy as the front-end in situations like that and have that proxy to the appropriate backend server. (Though making your node.js process a proxy server is a valid approach too depending on your needs).
for httpd.conf
activiate the module , proxy_module and proxy_http
if you are using virtual host
<virtualhost ...>
ServerName api.domain.com
........
ProxyPreserveHost On
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
</virtualhost>
assume you are running nodejs server at 8080 , you don't need to take care ssl in nodejs , all should be done in apache
then try https://api.domain.com/
I found a cool gist Run apache and nodejs on port 80. did not try it yet but will do of course
Step 1
Get a VPS that offers 2 or more IP addresses.
Step 2
From the WHM cPanel, find the menu item Service Configuration,
select Apache Configuration and then click on Reserved IPs Editor.
Step 3
Tick the IP address you DON'T WANT Apache to listen to, and write
it down so you can use it in the next step. Click Save.
Step 4
Install Node.js, and create a server like this:
var http = require('http');
var server = http.createServer(function(req, res) {
res.writeHead(200);
res.end('Hello, world!');
});
server.listen(80, '111.111.111.111');
Replacing 111.111.111.111 with the IP address you previously
reserved from the WHM cPanel.
Step 5
Stop wasting your time and never listen to those telling you to use
mod_rewrite to proxy Node.js again.
Update:
We can solve a problem in many different ways and IMHO, we should at least know each possible way 😉. We can do it without buying a new IP of course putting a proxy in front of both Apache and NodeJS server each running other ports except 80.