How do I reinstall Apache 2.2 on Ubuntu 13.10? - apache

I have a VPS running Ubuntu 13.10 and Apache which I use to host Rails sites.
Yesterday I decided to do a release upgrade before applying a shellshock patch $do-release-upgrade. The upgrade failed with a broken pipe error (I should have made a note of the exact error but didn't — sorry). I logged back in and the Ubuntu version remains the same. I noticed that Apache didn't restart so tried to start it up myself $ sudo /etc/init.d/apache2 start but I'm getting an error:
* Starting web server apache2
apache2: Syntax error on line 16 of /etc/apache2/apache2.conf: Cannot load
/home/simon/.rvm/gems/ruby-1.9.3-p448/gems/passenger-4.0.19/buildout/apache2/mod_passenger.so
into server: /home/simon/.rvm/gems/ruby-1.9.3-p448/gems/passenger-4.0.19/buildout/apache2/mod_passenger.so:
undefined symbol: unixd_config
Action 'start' failed.
I've read that this type of error can happen when upgrading from Apache 2.2 - 2.4. I'm not 100% what version I was on before (or if it even upgraded yesterday — I'm assuming it did but feel free to tell me if I'm making stupid assumptions) but currently Server version: Apache/2.4.6 (Ubuntu) is installed.
Is there a way for me to re-install Apache 2.2? (Is this even likely to rectify my issue or is there a better solution that I should try out?)

The cause of your problem isn't Apache. It's Phusion Passenger. You installed Phusion Passenger against an older Apache version. Then you upgraded your OS, which upgraded Apache too, so that broke Phusion Passenger and now Apache refuses to start.
The solution: reinstall Phusion Passenger, so that it is recompiled against your current Apache version. Don't reinstall Apache; that doesn't help.

Related

How to fix HTTPD (Apache) Error 256 on OSX Monterey 12.5

I have a Apache2 installed with Homebrew on a Mac running OSX Monterey. I haven't done LAMP development for a while, so I'm not sure when the error started, but I've recently updated OSX to 12.5. When I returned to working on a LAMP project, my Apache installation stopped working. Running brew services produced the following output: Name Status User File httpd error 256 root ~/Library/LaunchAgents/homebrew.mxcl.httpd.plist mysql started Nizz0k ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist.
Running the stop, start, and restart commands produces "success" output in the terminal, but Apache doesn't work. I can't navigate to my local vhosts, and of course, running brew services still shows an error.
In running apachectl -e error Apache complains about permissions to the error logs
I have tried:
uninstalling and reinstalling HTTPD
The apr-utilities fix.
confirming Mac installed Apache is stopped.
At this point, I think my problem is that there was conflicting information about how to run Apache on Homebrew. Earlier versions apparently required sudo, but running it this was now produces warnings like this:
Warning: Taking root:admin ownership of some httpd paths:
/usr/local/Cellar/httpd/2.4.54/bin
/usr/local/Cellar/httpd/2.4.54/bin/httpd
/usr/local/opt/httpd
/usr/local/opt/httpd/bin
/usr/local/var/homebrew/linked/httpd
This will require manual removal of these paths using `sudo rm` on
brew upgrade/reinstall/uninstall.
Warning: httpd must be run as non-root to start at user login!
/Library/LaunchDaemons/homebrew.mxcl.httpd.plist: service already bootstrapped
Bootstrap failed: 37: Operation already in progress
Error: Failure while executing; `/bin/launchctl bootstrap system /Library/LaunchDaemons/homebrew.mxcl.httpd.plist` exited with 37.
The issue is even after removing the paths as suggested in the error, a reinstallation brings Root back as the owner.
I do have the same problem with nginx.
Manually unloaded it and then restarting it worked fine.
Try:
sudo launchctl bootout system /Library/LaunchDaemons/homebrew.mxcl.httpd.plist
sudo brew services start httpd

httpd not showing/using most updated version of apache (via brew)

I just installed the latest version of Apache (2.4.43) using brew on Mac OS (10.14.5). (Using instructions from this site.) But after restarting the service, httpd -v still shows 2.4.34 running from the Mac OS default. The same old version is shown when I query apachectl -v.
Thinking that perhaps I needed to update with one more step, I ran brew update httpd but it said that "httpd 2.4.43 already installed."
I'm still pretty new to using brew, and this is my first time creating an Apache server, so any help here would be appreciated. Thanks!
Sorry - easy fix. I neglected to update my .bash_profile to include /usr/local/opt/apache2/bin.
This was clear after I ran which apachectl, and it displayed the default directory for the preinstalled version of Apache - /usr/sbin/apachectl.
I ended up stopping the default version and prevented it from starting again on boot:
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
Then, started the newly installed version, and it worked fine.

passenger_apache2 cookbook fails

I attempting to deploy a number of cookbooks to configure Apache2 and Passenger on Ubuntu 14.04. Below is the list of cookbooks I am installing in the order in which they appear in the run_list:
build-essential 2.1.3,
apt 2.6.1,
iptables 0.14.1,
logrotate 1.7.0,
apache2 2.0.0,
vim 1.1.2,
passenger_apache2 2.2.3
I am bootstrapping my vagrant vm from my development workstation and the cookbooks all appear to get installed with no errors, except when it gets to the passenger_apache2 cookbook. I can provide the entire extensive output, but I believe the following is the informative part of the output:
STDERR: [Wed Jan 21 14:05:17.027610 2015] [core:warn] [pid 26648] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
node.vagrantup.com (2)No such file or directory: AH02297: Cannot access directory '/etc/apache2/${APACHE_LOG_DIR}/' for log file '${APACHE_LOG_DIR}/other_vhosts_access.log' defined at /etc/apache2/conf-enabled/other-vhosts-access-log.conf:2
node.vagrantup.com AH00014: Configuration check failed
I have seen only a couple of discussions indicating an issue with the $HOME environment variable not being set for the daemonized chef-client. However, I am unclear on how to remedy this situation. I would appreciate any insight the community can provide as I learn how to use Chef.
Thx
UPDATE: Viewing the passenger_apache2 cookbook README, apparently this cookbook is not yet supported on Ubuntu 14.04 due to the use of Apache 2.4 in that version of the OS. Further, I see I missed an error in the output which says:
WARNING: Apache doesn't seem to be compiled with the 'prefork', 'worker' or 'event' MPM
node.vagrantup.com Phusion Passenger has only been tested on Apache with the 'prefork', the
node.vagrantup.com 'worker' and the 'event' MPM. Your Apache installation is compiled with
node.vagrantup.com the '' MPM. We recommend you to abort this installer and to recompile
node.vagrantup.com Apache with either the 'prefork', the 'worker' or the 'event' MPM.
Curious to know if anyone is deploying passenger on Ubuntu 14.04 with Apache 2.4 using Chef Server. If so, how?
UPDATE 2: I can not get this working with the supposedly supported Ubuntu 12.04 either. Would really like to know if anybody has this cookbook working and if so, how.
I fixed this issue by taking the following actions:
Downloaded the latest Apache2 cookbook and uploaded it to my Chef server
Downloaded the latest Passenger_Apache2 cookbook.
Uploading the new Passenger_Apache2 cookbook failed with an error indicating that there was a dependency on Apache 1.0 that was unmet. I then modified the metadata.rb file of the Passenger_Apache2 cookbook and changed the following line:
depends 'apache2', '~> 1.0'
to:
depends 'apache2', '~> 3.0'
Now when I bootstrap my chef node, it installs passenger with no errors. Hope this helps others.

How to setup php-fpm on CentOS 7?

There are a lot of guides out there about setup php-fpm for Apache on CentOS 5x or 6x but none of them are working on Centos 7. I searched for days but can't find any solution.
yum install php-fpm
This command succesfully working.
But then i stuck with this line:
yum install mod_fastcgi
The error is "There is no package as mod_fastcgi"
Is there any mod_fastcgi module compatible with CentOS 7? If so, how can i complete php-fpm setup? Please guide me.
My server have some trouble about memory usage. So i have to optimize Apache. Here is my "top" result.
Deploy PHP with FastCGI
If you are using PHP code with your application, you will need to implement “PHP-FastCGI” in order to allow Nginx to properly handle and parse PHP code. You can install this via YUM from the EPEL repository that was previously installed:
yum install php-cli php spawn-fcgi

Passenger crashes, hangs at apache start

On a fresh installation of Ubuntu, with Ruby/Rails/RVM with Apache via Passenger, apache will come up on a clean reboot, but crash at the first request to the Rails app.
I have done all of this many times before ... except RVM installed in multi-user mode.
It seems like maybe there's some library conflict?
Details below.
64-bit Ubuntu 11.10 installation
created a release user, and group
uninstall the default apache, ruby, passenger (sudo apt-get remove ...)
installed RVM using the system version (multiple users)
installed ruby 1.9.3p194 using RVM (installed as the release user)
add release user to group rvm
ruby and gems are under /usr/local/rvm/ and are all in group rvm and readable
install apache2 and various supporting libraries (sudo apt-get install apache2)
add apache2 user (www-data) to group rvm
install passenger from gem (gem install passenger)
use passenger to make passenger module (passenger-install-apache2-module). No errors.
configure apache to load the correct module (under /usr/local/rvm...)
configure apache to reference the correct PassengerRoot and PassengerRuby
note: this is all without any reference to the Rails app
start apache (sudo apache2ctl start) ... this hangs
Apache error.log shows
[ pid=1303 thr=140033289561952 file=ext/apache2/Hooks.cpp:1389 time=2012-05-07 19:54:15.497 ]: Initializing Phusion Passenger...
[ pid=1303 thr=140033289561952 file=ext/apache2/Hooks.cpp:1664 time=2012-05-07 19:54:15.536 ]: Shutting down Phusion Passenger...
[ pid=1312 thr=140533444790112 file=ext/common/LoggingAgent/Main.cpp:283 time=2012-05-07 19:54:15.537 ]: Logging agent online, listening at unix:/tmp/passenger.1.0.1303/generation-0/logging.socket
In other words, passenger terminates moments after it starts. /var/log/syslog shows a stack dump for PassengerWatchd.
I tried running passenger in standalone mode. Nada.
Any ideas?
For anyone looking, this ended up being an issue for several people, and there are several good workarounds posted on the Passenger Google Group here
Make sure your passenger.conf is using the same version of ruby as in your console.
$ cat /etc/apache2/mods-available/passenger.conf
PassengerRuby /home/ubuntu/.rvm/rubies/ruby-1.9.2-p320/bin/ruby
PassengerRoot /home/ubuntu/.rvm/gems/ruby-1.9.2-p320/gems/passenger-3.0.18
PassengerDefaultUser www-data
Compare the PassengerRuby is the same as:
$ which ruby
/home/ubuntu/.rvm/rubies/ruby-1.9.2-p320/bin/ruby