How to configure HHVM with Apache compiled from source? - apache

Today, when HHVM has been updated (Ubuntu 12.04 x64), I try run the fast_cgi install command. Like below:
➜ ~ sudo /usr/share/hhvm/install_fastcgi.sh
Checking if Apache is installed
WARNING: Couldn't find Apache2 configuration paths, not configuring
Checking if Nginx is installed
Nginx not found
My apache was not found because it's in different location/folder: /etc/apache247/
How can I configure this install for a custom apache?
The script for check apache installation is that:
#!/bin/bash
if [ -f /etc/init.d/hhvm ]
then
/etc/init.d/hhvm start
fi
#!/bin/bash
apache_check_installed() {
echo "Checking if Apache is installed"
if [ \( ! -d /etc/apache2/mods-enabled \) -o \( ! -d /etc/apache2/mods-available \) ]
then
echo "WARNING: Couldn't find Apache2 configuration paths, not configuring"
return 1
fi
echo "Detected Apache installation"
return 0
}
Sorry for my english.

You can follow the instructions on the HHVM Wiki to manually configure Apache to talk FastCGI to HHVM.
The installation process comes down to enabling the mod_proxy and mod_proxy_fcgi modules in Apache, then adding ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/path/to/your/www/root/goes/here/$1 to the VirtualHost you want to run HHVM on.

Related

How can I check server configuration ("$ httpd -S") in MAMP?

I have previously installed Apache on my Mac Mini using Homebrew, but I'm currently using MAMP. When I issue the terminal command httpd -S to check Apache configurations, it checks the Homebrew configurations. Is there a way I can test the configurations for MAMP? I would like to use the same httpd -S command, but if there's another preferred way to do it for MAMP, that's fine too.
You do it with the -f flag, like this:
httpd -f /Applications/MAMP/conf/httpd.conf -S
This is in httpd options:
Options:
...
-f file: specify an alternate ServerConfigFile

How to upgrade apache 2.2.15 to apache 2.4.12 on CentOS 6.6?

I tried ,but didn't work for me.
Apache 2.4 on CentOS 6.6:
Step 1:
cd /etc/yum.repos.d/
wget http://repos.fedorapeople.org/repos/jkaluza/httpd24/epel-httpd24.repo
Step 2:
yum install httpd24.x86_64
Step 3:
$ /opt/rh/httpd24/root/usr/sbin/httpd -version
Server version: Apache/2.4.6 (Red Hat)
Server built: Sep 25 2013 05:25:46
NOTE: config files are in: /opt/rh/httpd24/root/etc/httpd
$ ls
conf conf.d conf.modules.d logs modules run
EDIT: in case you want to switch off Apache 2.2
$ chkconfig httpd off
$ chkconfig --list | grep httpd
httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
httpd24-httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
EDIT 2: http://wiki.apache.org/httpd/PHP-FPM
yum install php-fpm
/etc/init.d/php-fpm start
Does any body knows the solutions, please let me know.
It would be best if you built it yourself from the Apache source code on a CentOS 6.6 system.
Compiling and Installing Apache 2.4:
http://httpd.apache.org/docs/current/install.html
Make note of the configure line during the build so you can make sure it includes all the modules you want (Like mod_ssl...etc..). Details on what is available for the configure line located here http://httpd.apache.org/docs/current/programs/configure.html
$ CC="pgcc" CFLAGS="-O2" \
./configure --prefix=/sw/pkg/apache \
--enable-ldap=shared \
--enable-lua=shared
If you want your own RPM, create a SPEC file with your own customizations.
The easiest way is to install the SCL version, as described here:
https://unix.stackexchange.com/questions/412122/how-to-update-apache-to-2-4-29-using-scl

Can't start apache with supervisord from a Docker container

I'm running a Docker container with CoreOS which uses Debian latest as a base and has various packages installed including supervisor and apache2. I can start and successfully run apache using the following command:
# /usr/bin/pidproxy /var/run/apache2.pid /bin/bash -c "source /etc/apache2/envvars && /usr/sbin/apache2 -DFOREGROUND -k start"
However, when I stick this command in a supervisor config file:
[program:apache2]
command=/usr/bin/pidproxy /var/run/apache2.pid /bin/bash -c "source /etc/apache2/envvars && /usr/sbin/apache2 -DFOREGROUND -k start"
redirect_stderr=true
and do this:
# supervisorctl start apache2
I get back this response:
apache2: ERROR (abnormal termination)
Looking at the supervisor process log file I see the help output from the apache2 command, as if it had been called like so apache2 -h. I have no idea why a command which runs when executed on the command line as root (ssh into the container) would not work when verbatim executed by supervisorctl (run as root).
Any point in the right direction would be greatly appreciated.
Not really sure why, but adding quotes to my option values seems to have done the trick, and allowed me to use apachectl. Must be something with the context in which the command is interpreted, whatever supervisor is doing vs input from a bash prompt. Here's my working config file:
[program:apache2]
command=apachectl -D "FOREGROUND" -k start
redirect_stderr=true
You really want to use this. If you don't use pidproxy, a supervisorctl stop apache will not kill all it's children.
This will also make sure that the container will quit when it gets a SIGTERM instead of waiting for a SIGKILL.
[program:apache]
command=/usr/bin/pidproxy /var/run/apache2/apache2.pid /bin/bash -c "/usr/sbin/apache2ctl -D FOREGROUND"
autorestart=true
This is what works for me (using an ubuntu base image, but that should not matter):
Dockerfile:
# Pull Ubuntu as base image
FROM dockerfile/ubuntu
...
# Install supervisor to allow starting mutliple processes
RUN apt-get -y install supervisor && \
mkdir -p /var/log/supervisor && \
mkdir -p /etc/supervisor/conf.d
RUN mkdir /var/log/supervisord
# Add supervisor configuration
ADD etc/supervisor/supervisor.conf /etc/supervisor.conf
# Install Apache and enable CGI
RUN apt-get install -y apache2
ADD etc/apache/000-default.conf /etc/apache2/sites-available/000-default.conf
RUN a2enmod cgi
....
supervisor.conf
[supervisord]
; supervisord log file
logfile=/var/log/supervisord/supervisord.log
; info, debug, warn, trace
loglevel=debug
; pidfile location
pidfile=/var/run/supervisord.pid
; run supervisord as a daemon
nodaemon=false
; number of startup file descriptors
minfds=1024
; number of process descriptors
minprocs=200
; default user
user=root
; where child log files will live
childlogdir=/var/log/supervisord/
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; Apache server
[program:apache2]
command=/usr/sbin/apache2ctl -D FOREGROUND
environment=APACHE_LOG_DIR=/var/log/apache2
redirect_stderr=true
In CentOS apache is Called httpd not apache2
Your supervisor conf file will need to be updated for CentOS
/usr/sbin/httpd is the program location.
[program:apache2]
command=/usr/bin/pidproxy /var/run/httpd.pid /bin/bash -c "/usr/sbin/httpd -DFOREGROUND -k start"
redirect_stderr=true

Path of glassfish 3.1.1

I searched google for an answer for this question but I haven't got the exact answer. I want to install glassfish in Suse linux server. I downloaded glassfish3.sh from oracle but when I run that script, the folder where glassfish is installed is /home/$user/glassfish and I want to change it.
Does someone know how to change the path of glassfish 3.1.1 in ubuntu server? (only terminal)
Thanks!
You downloaded the .sh file. This will always install GlassFish into the user's home directory. In order to install it into different directory it is a little bit more work to do.
Download and unzip the file. For e.g. you want glassfish to be in: /opt/glassfish:
wget http://download.java.net/glassfish/3.1.1/release/glassfish-3.1.1.zip
sudo unzip glassfish-3.1.1.zip -d /opt
That is it. Glassfish is installed and you can start and use it. But don't forget that you did not configure any automatic start up scripts to glassfish start up automatically.
In order to do that, run this command in your shell:
sudo vim /etc/init.d/glassfish
Paste this content: (first make change that is appropriate to you)
#!/bin/bash
GLASSFISH_HOME=/opt/glassfish3
case "$1" in
start)
${GLASSFISH_HOME}/bin/asadmin start-domain domain1
;;
stop)
${GLASSFISH_HOME}/bin/asadmin stop-domain domain1
;;
restart)
${GLASSFISH_HOME}/bin/asadmin stop-domain domain1
${GLASSFISH_HOME}/bin/asadmin start-domain domain1
;;
*)
echo "usage: $0 {start|stop|restart}"
;;
esac
exit 0
The last thing is to make the script executable by running these commands:
sudo chmod 755 /etc/init.d/glassfish
sudo update-rc.d /etc/init.d/glassfish defaults
Now you can start, stop and restart glassfish like this:
sudo /etc/init.d/glassfish start
sudo /etc/init.d/glassfish stop
sudo /etc/init.d/glassfish restart

How to check mod_headers and mod_expires modules enabled in apache

I want to check whether mod_headers and mod_expires modules enabled or not in my server
Is there a way available to list apache enabled/disabled modules using some php function just like we list php information with phpinfo(); function?
All the above answers are wrong. Use instead:
apachectl -t -D DUMP_MODULES
or
apachectl -M
On Debian:
user#machine:~$ /usr/sbin/apache2 -l
Most GNU/Linux distros:
user#machine:~$ /usr/sbin/httpd -l
Ubuntu:
user#machine:~$ ls /etc/apache2/mods-enabled
On Mac OSX:
user#mymac:~$ httpd -l
On Win 7 (64-bit):
C:\Users\myuser>"\Program Files (x86)\Apache Software Foundation\Apache2.2\bin\httpd.exe" -l
Try these commands from a terminal window in all but Windows, which will use CMD instead.
On Ubuntu you can see the list of enabled modules here,
/etc/apache2/mods-enabled
Some versions of PHP/Apache show all loaded modules in phpinfo() under "Loaded Modules".
Speeve's answer shows compiled in modules (x6 on my system):
echo system('/usr/sbin/apache2 -l');
You'll also need to see your enabled modules (x36 for me):
echo system('ls /etc/apache2/mods-enabled/');
To get the list of disabled modules, run this command then cross off all the enabled modules:
echo system('ls /etc/apache2/mods-available/');