Need some help moving a rails app from webrick to passenger with apache. Im very new to all this and i cant get it running with passenger. I have tried a bunch of guides and I am not getting any errors apart from the rails server always using webrick instead of passenger. I am working on mac mini OSX as server
I seen that osx comes with a version of mac already installed but i read online that i should load a newer copy so i make sure that the currently installed apache is not running in system preferences/sharing/web sharing.
then i brew install apachetop. followed by gem install passenger and passenger-install-apache2-module .
I then follow the instructions from passenger in terminal which asks me to place some code in the httpd.conf file. which i find in /ect/apache2 from root.
I then add the virtual host info to the apache config file too where /public/mom is location of my rails app.
<VirtualHost *>
ServerName localhost:3000
DocumentRoot /public/mom
RailsEnv development
<Directory /public/mom>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
I then make sure apache is running with sudo apachectl start and try running my rails server but it still runs using webrick.
I have seen posts saying that i need to make sure that passenger is installing with the correct version of apache that i installed. how do i force passenger to install with the apache i installed rather then default? am i ment to be naming the servername within the config file as localhost? Can anyone give me some guidance on how to get the rails app running with passenger . maybe i missed some steps or misunderstood the process completely. thanks
edit: below is apache error_log
[Wed Jul 20 19:17:01 2011] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
httpd: Could not reliably determine the server's fully qualified domain name, using mini.local for ServerName
[Wed Jul 20 19:17:02 2011] [notice] Digest: generating secret for digest authentication ...
[Wed Jul 20 19:17:02 2011] [notice] Digest: done
[Wed Jul 20 19:17:02 2011] [notice] Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8r DAV/2 Phusion_Passenger/3.0.7 configured -- resuming normal operations
[Wed Jul 20 19:17:22 2011] [notice] caught SIGTERM, shutting down
[Wed Jul 20 19:39:32 2011] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
httpd: Could not reliably determine the server's fully qualified domain name, using mini.local for ServerName
[Wed Jul 20 19:39:45 2011] [notice] Digest: generating secret for digest authentication ...
[Wed Jul 20 19:39:45 2011] [notice] Digest: done
[Wed Jul 20 19:39:45 2011] [notice] Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8r DAV/2 Phusion_Passenger/3.0.7 configured -- resuming normal operations
[Wed Jul 20 19:43:33 2011] [notice] caught SIGTERM, shutting down
[Wed Jul 20 20:09:35 2011] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
Warning: DocumentRoot [/public/mom] does not exist
httpd: Could not reliably determine the server's fully qualified domain name, using mini.local for ServerName
[Wed Jul 20 20:09:35 2011] [notice] Digest: generating secret for digest authentication ...
[Wed Jul 20 20:09:35 2011] [notice] Digest: done
[Wed Jul 20 20:09:35 2011] [notice] Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8r DAV/2 Phusion_Passenger/3.0.7 configured -- resuming normal operations
[Thu Jul 21 10:36:59 2011] [notice] caught SIGTERM, shutting down
"try running my rails server but it still runs using webrick", seems your webrick is still active.
lsof -i -P |grep 3000
kill -9 WEBRICK_PID
Related
The Apache2 on my Docker container keeps failing on starting; I already check the config using apachectl configtest, and it's returning OK. The error below is what I found under /var/log/apache2/error.log
[Wed Aug 10 15:17:30.643137 2022] [mpm_event:notice] [pid 465:tid 139744629492672] AH00489: Apache/2.4.52 (Ubuntu) mod_jk/1.2.46 configured -- resuming normal operations
[Wed Aug 10 15:17:30.643188 2022] [core:notice] [pid 465:tid 139744629492672] AH00094: Command line: '/usr/sbin/apache2'
[Mon Oct 31 22:14:51.535467 2022] [jk:crit] [pid 63:tid 274907793600] (95)Operation not supported: mod_jk: could not create jk_log_lock
But when I tried to uninstall and reinstall apache2, I could access the localhost:80, but the ColdFusion under it was not working. It just shows me the directory of the working directory..
Docker Desktop: v4.13.1
Docker: version 20.10.20, build 9fdeb9c
ColdFusion: 2018
This happens only on my Macbook 13 M2. I tried running it on a windows laptop, and it's working well.
Here is my Dockerfile to create a simple web server based on CentOS 8:
FROM centos:8
RUN yum -y update && \
yum -y install httpd php
COPY . /var/www/html
CMD ["httpd", "-D", "FOREGROUND"]
I build and run the container with the following commands:
docker build -t web .
docker run --rm --name web -p 8000:80 --network net1 --mount type=bind,source=`pwd`,target=/var/www/html web
The error I see when accessing http://localhost:8000 is:
Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
The httpd logs say:
[Sat Jun 20 04:42:02.970003 2020] [suexec:notice] [pid 1:tid 140041021270272] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.19.0.2. Set the 'ServerName' directive globally to suppress this message
[Sat Jun 20 04:42:02.994125 2020] [lbmethod_heartbeat:notice] [pid 1:tid 140041021270272] AH02282: No slotmem from mod_heartmonitor
[Sat Jun 20 04:42:02.995333 2020] [http2:warn] [pid 1:tid 140041021270272] AH02951: mod_ssl does not seem to be enabled
[Sat Jun 20 04:42:03.001899 2020] [mpm_event:notice] [pid 1:tid 140041021270272] AH00489: Apache/2.4.37 (centos) configured -- resuming normal operations
[Sat Jun 20 04:42:03.002120 2020] [core:notice] [pid 1:tid 140041021270272] AH00094: Command line: 'httpd -D FOREGROUND'
[Sat Jun 20 04:42:04.782201 2020] [proxy:error] [pid 8:tid 140040377865984] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /run/php-fpm/www.sock (*) failed
[Sat Jun 20 04:42:04.782280 2020] [proxy_fcgi:error] [pid 8:tid 140040377865984] [client 172.19.0.1:41072] AH01079: failed to make connection to backend: httpd-UDS
The problem is not as clear to me as it seems. I think it's a php-fpm issue, but have no idea how to fix it. Looked this up, but all solutions seem complicated. Is there a simple way to tell PHP to work with the server in the Docker image?
I recently read about using process managers like supervisord where one needs to start several services per container. But, is it possible to start PHP-FPM in a simpler way inside the web container?
I managed to tackle it when using a base rhel 8 image by
CMD ["bash", "-c", "/usr/sbin/apachectl start; /usr/sbin/php-fpm --nodaemonize"]
But when I tried it with base centos 8 image, it doesn't work, I don't know why
FROM centos:8
RUN yum -y update && \
yum -y install php-fpm httpd
COPY . /var/www/html
CMD ["httpd", "-D", "FOREGROUND"]
I successfully created a simple container image based on centos:7 and it just works fine serving php files from document root. But, when I change the base to centos:8, php files are not served. The 503 Apache page is shown saying "The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later."
When I look into /etc/httpd/logs/error_log inside the running container, I see:
[Wed Jun 10 10:57:33.236099 2020] [proxy:error] [pid 7:tid 139731249620736] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /run/php-fpm/www.sock (*) failed
[Wed Jun 10 10:57:33.237322 2020] [proxy_fcgi:error] [pid 7:tid 139731249620736] [client 172.17.0.1:46224] AH01079: failed to make connection to backend: httpd-UDS
[Wed Jun 10 10:57:34.183056 2020] [proxy:error] [pid 7:tid 139731224442624] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /run/php-fpm/www.sock (*) failed
[Wed Jun 10 10:57:34.183132 2020] [proxy_fcgi:error] [pid 7:tid 139731224442624] [client 172.17.0.1:46228] AH01079: failed to make connection to backend: httpd-UDS
Tried to make a difference by creating /run/php-fpm directory inside the container for testing purposes, but the error still persists.
I really wish this would be solvable without seding something into php-fpm or httpd configuration files of the container.
I installed opencpu Docker image using
docker pull opencpu/ubuntu-16.04.
The very first time it starts sucessfully. But if I terminate the process and try to start it again using command
docker run -it imageID
It gets terminated each time. Need suggestion about how to start it successfully.
Desktop$ docker run -it d98852787b8e
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.4. Set the 'ServerName' directive globally to suppress this message
[Thu Mar 08 06:34:52.836970 2018] [ssl:warn] [pid 11] AH01909: 172.17.0.4:443:0 server certificate does NOT include an ID which matches the server name
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.4. Set the 'ServerName' directive globally to suppress this message
[Thu Mar 08 06:34:52.849109 2018] [ssl:warn] [pid 11] AH01909: 172.17.0.4:443:0 server certificate does NOT include an ID which matches the server name
[Thu Mar 08 06:34:52.849219 2018] [core:warn] [pid 11] AH00098: pid file /var/run/apache2/apache2.pid overwritten -- Unclean shutdown of previous Apache run?
[Thu Mar 08 06:34:52.851132 2018] [mpm_prefork:notice] [pid 11] AH00163: Apache/2.4.18 (Ubuntu) mod_R/1.2.7 R/3.2.2 OpenSSL/1.0.2g mod_apreq2-20090110/2.8.0 configured -- resuming normal operations
[Thu Mar 08 06:34:52.851152 2018] [core:notice] [pid 11] AH00094: Command line: '/usr/sbin/apache2 -D FOREGROUND'
[Thu Mar 08 06:34:52.872738 2018] [mpm_prefork:notice] [pid 11] AH00170: caught SIGWINCH, shutting down gracefully
Using locale: en_US.UTF-8
Using locale: en_US.UTF-8
AppArmor not available. Running OpenCPU without security profile but with rlimits.
Using locale: en_US.UTF-8
AppArmor not available. Running OpenCPU without security profile but with rlimits.
AppArmor not available. Running OpenCPU without security profile but with rlimits.
Using locale: en_US.UTF-8
Using locale: en_US.UTF-8
AppArmor not available. Running OpenCPU without security profile but with rlimits.
AppArmor not available. Running OpenCPU without security profile but with rlimits.
Loading config from /usr/lib/opencpu/library/opencpu/config/defaults.conf
Loading config from /usr/lib/opencpu/library/opencpu/config/defaults.conf
Loading config from /etc/opencpu/server.conf
Loading config from /usr/lib/opencpu/library/opencpu/config/defaults.conf
Loading config from /etc/opencpu/server.conf
Loading config from /usr/lib/opencpu/library/opencpu/config/defaults.conf
OpenCPU cloud server ready.
OpenCPU cloud server ready.
Loading config from /etc/opencpu/server.conf
Loading config from /etc/opencpu/server.conf
OpenCPU cloud server ready.
OpenCPU cloud server ready.
Loading config from /usr/lib/opencpu/library/opencpu/config/defaults.conf
Loading config from /etc/opencpu/server.conf
OpenCPU cloud server ready.
rserver[8]: ERROR system error 10 (No child processes); OCCURRED AT: rstudio::core::Error rstudio::server::app_armor::enforceRestricted() /home/ubuntu/rstudio/src/cpp/server/ServerAppArmor.cpp:90; LOGGED FROM: int main(int, char* const*) /home/ubuntu/rstudio/src/cpp/server/ServerMain.cpp:513
Terminated
Perhaps this can give you some hint... this is not exactly the solution but if gives you at a high level what could be the cause and lead to the solutioni.enter link description here
This seems to be a problem with the rstudio-server package. I will add the workaround suggested above (server-app-armor-enabled=0) to the opencpu docker images.
Note that the opencpu/base image does install rstudio, so you may want to try this one.
What is the output of
sudo docker logs <container-name> ?
Most likely it would be something indicating the httpd pid exists. Which means you need to delete the apache2.pid in the container. But now since the container does not boot up a hack is to edit your container's config.v2.json file located in /var/lib/docker/containers/<container-long-id>/
In the CMD section, change "service cron start && apachectl -DFOREGROUND" to "rm -f /var/run/apache2/apache2.pid && service cron start && apachectl -DFOREGROUND". This will ensure your container will start. Worked for me!
I installed passenger with apache on centos7.
After I installed successfully, I put this passenger config in httpd.conf of apache, then I restart apache again, I still get error as below,
Jan 25 04:11:14 ip-10-0-0-201 systemd[1]: Starting The Apache HTTP Server...
Jan 25 04:11:14 ip-10-0-0-201 httpd[26168]: httpd: Syntax error on line 351 of /etc/httpd/conf/httpd.conf: Cannot load /home/centos/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/passenger-5.1.12/buildout/apache2...
Jan 25 04:11:14 ip-10-0-0-201 systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jan 25 04:11:14 ip-10-0-0-201 kill[26170]: kill: cannot find process ""
Jan 25 04:11:14 ip-10-0-0-201 systemd[1]: httpd.service: control process exited, code=exited status=1
Jan 25 04:11:14 ip-10-0-0-201 systemd[1]: Failed to start The Apache HTTP Server.
Jan 25 04:11:14 ip-10-0-0-201 systemd[1]: Unit httpd.service entered failed state.
Jan 25 04:11:14 ip-10-0-0-201 systemd[1]: httpd.service failed.
This is my httpd.conf
#EnableMMAP off
EnableSendfile on
LoadModule passenger_module /home/centos/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/passenger-5.1.12/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /home/centos/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/passenger-5.1.12
PassengerDefaultRuby /home/centos/.rbenv/versions/2.5.0/bin/ruby
</IfModule>
# Supplemental configuration
#
# Load config files in the "/etc/httpd/conf.d" directory, if any.
IncludeOptional conf.d/*.conf
If i remove code above from httpd.conf, I can still restart apache successfully.
Any suggestions are much appreciated.