HHVM through Apache mod_fastcgi on debian - apache

I've been able to rather easily get facebooks hhvm working from prebuilt debian packages as well as compile it, and afterwards to run it behind apache as a proxy. The problem with the proxy setup is though, that I can't get response headers other than http status code 200 - like 304 for example - through. It's not the proxy config of apache, but something wrt hhvm and apache interact, or even in hhvm.
Anyway, HHVM officially stopped supporting the standalone server, and they're moving over to fastcgi, and as all of our servers are running Debian, I don't have access to mod_proxy_fastcgi without compiling it (the only backports I found of apache 2.4 don't have mod_proxy_fastcgi backported unfortunately).
So I'm currently trying to get HHVM to run behind the old mod_fastcgi with apache 2.2. But currently I'm only getting "connect() failed" in the error log of apache, while hhvm is listening on :::1080
The important part of my apache config is
RemoveHandler application/x-httpd-php
FastCgiExternalServer /home/www/hhvm/hostname/htdocs/php5.fcgi -flush -host ip6-localhost:1080
AddType application/x-hhtpd-fastphp5 .php
Action application/x-httpd-fastphp5 /php5.fcgi
Alias /php5.fcgi /home/www/hhvm/hostname/htdocs/php5.fcgi
netstat also lists hhvm as listening on :::1080 and I can connect to it via telnet
Any Ideas on what I need to change so it works?

Looks like a IP6 port problem. Try \[ip6-localhost\]:1080 . Not sure if this has side effects in Apache.
How do ports work with IPv6?

Related

How to enable http2 on CentOS7 with Apache 2.4.46

I have CentOS 7, with Apache 2.4.46. I have done pretty much every thing available on internet. I am getting the below error
The mpm module (prefork.c) is not supported by mod_http2. The mpm
determines how things are processed in your server. HTTP/2 has more
demands in this regard and the currently selected mpm will just not
do. This is an advisory warning. Your server will continue to work,
but the HTTP/2 protocol will be inactive.
My apache is running from /usr/local/apache2/.
I have seen, I may need to use php-fpm module to run this.
I have made changes on my live server and It is kinda stuck now. Though work impact is very less but I really want to learn what wrong am I doing
You would need to:
Disable mod_mpm_prefork
Disable mod_php (disable the php module, what ever it's named, example: libphp7)
Enable mod_mpm_event
Enable mod_http2
Enable mod_proxy
Enable mod_proxy_fcgi
Enable mod_setenvif
Install PHP-FPM using yum install php-fpm, or you might need to specify the version yum install php7-fpm or php8-fpm, and then start the PHP-FPM service after installation of that, using systemctl start php-fpm or php7-fpm/php8-fpm.
Add the following to Apache configuration:
<FilesMatch "*\.php">
SetHandler "proxy:fcgi://localhost:9000"
</FilesMatch>
If it is running as an UNIX socket, you would need to change it to:
<FilesMatch "*\.php">
SetHandler "proxy:unix:/path/to/php-fpm.sock|fcgi://localhost:9000"
</FilesMatch>
Restart Apache

Why does AEM dispatcher refuse to connect?

I tried to follow the instruction from
https://helpx.adobe.com/experience-manager/kt/platform-repository/using/dispatcher-macos-technical-video-setup.html
to set up an AEM dispatcher on my MacBook.
The version of my operating system is Catalina 10.15.1, so there should not be an issue of macOS Mojave. Since AEM does not support builtin Apache anymore, I installed brew's Apache on homebrew. Then, I start my AEM server on my localhost:4053, and started my Apache dispatcher.
Then, I go to the following link:
http://aem-publish.local/content/we-retail/us/en.html
It gave the error of
aem-publish.local refused to connect.
What can be possibly causing this error?
The problem was just that The tutorial uses port 80, but Apache uses port 8080 by default.
I just have to change the port number to 8080 on aem-publish.local.conf file.
Or, I can change the port number to 80 in httpd.conf file.

Website default to apache page after upgrading to apache from 2.4.17 to 2.4.25

I've upgrade apache2 in order to take advantage of HTTP2.
But now I get the default Apache Ubuntu page when I try to access any of my websites ! - they are configured in separate vhost files in /etc/apache2/sites-available
For example : https://www.pretty-story.com/
Can someone tell me what could be the cause of this ? It's probably a simple configuration change, but I don't where to look at and I'm in panic mode.

reverse proxy apache to localhost server

I've got a web app running on localhost:3000. I also have an apache server. I would like to reverse proxy the apache server so that requests to /mywebapp get forwarded to the server running on localhost:3000.
I currently have the following config at the bottom of my httpd.conf file, but I'm getting a server error when I try to access it:
ProxyPass /mywebapp http://localhost:3000
ProxyPassReverse /mywebapp http://localhost:3000
Edit - further details:
I'm running a jetty server with java -jar myapp.jar. I'd like to forward requests to an apache server listening on :80 to the jetty server.
I've got mod_proxy_http.so and mod_proxy.so enabled.
I can tell the server is running on localhost - it responds to curl with the appropriate http response. So I'm pretty sure the issue is with my apache setup, but I can't think what the problem would be.
Apache conf file in conf.d for reference: http://pastebin.com/vhXwjbQe
And I've got this in my httpd.conf:
Include conf.d/*.conf
It's hard to give a generic answer because every situation is different so here are some debugging questions to ask yourself:
if the protocol and port correct on the internal service, http and 3000.
Is the service actually listening for connections from localhost? is it running in a docker container etc that would require it to be listening on a different interface? You can check for this by looking at the output from mywebapp's logs and see if the request are making it through the proxy.
Do the paths on the internal service include the prefix that is being passed to Apache or does apache need to strip these off. if for instance mywebapp expects the path "/foo/bar" and apache's reverse proxy is sending it with the context path included "/mywebapp/foo/bar" then it will not match any path in mywebapp.

Cannot load socket.io.js with apache proxy setup

I feel like this question might be a duplicate but from all similar threads I have checked still wasn't able to find a answer.
I have vhost setup to proxy /node/ request to NodeJS/Socket.IO server.
ProxyRequests On
ProxyPass /node http://192.168.2.151:1337/
ProxyPassReverse /node http://192.168.2.151:1337/
This setup successfully serves everything from Apache, expect requests: http://domain.com/node/
Everything works fine when it comes to NodeJS.
I just can't get this line:
<script src="/node/socket.io/socket.io.js"></script>
to load socket.io.js, it always spits out what NodeJS server has to say.
The setup:
index.html is served by Apache. http://domain.com/index.html
index.html is simple HTML with script tag for loading socket.io.js (like I wrote above).
When I request http://domain.com/index.html script src is loaded but the content is NodeJS servers response instead of socket.io.js.
I have 'npm install socket.io' in the directory where NodeJS server is running from.
I have tried to serve index.html with NodeJS as well, regardless - socket.io.js content is still NodeJS responce.
Did anyone had this problem? Or could link me to an answer? :)
Cheers!
Look at this question and all of the answers at serverfault: Configuring Apache2 to proxy WebSocket?.
The problem is that mod_proxy doesn't support WebSockets and just makes it an HTTP request. You could use a different port and avoid proxying, switch to Nginx, try haproxy or use various other Apache module alternatives. For instance, mod_proxy_wstunnel is basically mod_proxy with WebSockets support. See the serverfault link above for details on all of the solutions.