Upgrade Apache 2.4.6 to 2.4.27 without losing config - apache

I wan to updage my currently active apache v2.4.6 to latest ver 2.4.27. (CentOS 7)
I know how to install from stracth but I just want to upgrade the version with my configurations remain stil.
Would it be okay to remove whole httpd content with /etc/httpd, /run/httpd, and /usr/lib64/httpdwith takin configuration backup, then install 2.4.27 from scratch and paste the old config files?
Thank you in advance for any guidance

You can backup everything and add CodeIT rpm repo:
cd /etc/yum.repos.d && wget https://repo.codeit.guru/codeit.el7.repo
yum install -y epel-release
yum upgrade httpd
Please also be sure to merge your SSL configuration and mpm defaults to have new features like HTTP/2 protocol support enabled.

Related

How to Install apache httpd from source for jboss clustering

I am currently setting up a JBoss EAP 7 cluster in domain mode and the goal is for an apache webserver to be installed as a load balancer. However, I am unable to install the httpd service from yum repositories as this is a VM that was provisioned by a client. I need to install httpd from its source which I have downloaded. My problem is that I am not sure about the configuration options to enable for this purpose. Any help would be appreciated. From the official website, the instruction doesn't give details about what modules to be enabled and I'm not sure which of them are relevant for my own purpose.
Download Download the latest release from http://httpd.apache.org/download.cgi
Extract $ gzip -d httpd-NN.tar.gz
$ tar xvf httpd-NN.tar
$ cd httpd-NN
Configure $ ./configure --prefix=PREFIX
Compile $ make
Install $ make install
Customize $ vi PREFIX/conf/httpd.conf
Test $ PREFIX/bin/apachectl -k start
Above provided link will contain all module which provided with default Apache httpd. You can download the Apache httpd source folder and check module information in modules.In Apache source module/proxy folder contains module information regarding the proxy configuration. i.e mod_proxy module.
I was able to do my installation by following the guide here

Terminal command in fedora

What does the yum and -y means
yum install httpd -y
new to fedora. please guide me.
the above code will install Apache server in fedora
yum is a software package manager that installs, updates, and removes packages on RPM-based systems. It automatically computes dependencies and figures out what things should occur to install packages. yum makes it easier to maintain groups of machines without having to manually update each one using rpm.
-y means that we did't want to gave yes to install any package (here httpd)
httpd installs apache web server
Thanks for Support and advice

How to install mod_wgsi for apache 2.4+ with python3.5 on CentOS 7

As title says "How to install mod_wgsi for python3.5 on CentOS 7"?
$pip3.5 install mod_wgsi did not work
Collecting mod_wgsi
Could not find a version that satisfies the requirement mod_wgsi (from versions: )
No matching distribution found for mod_wgsi
sudo yum install libapache2-mod-wsgi-py3 failed too:
Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with Subscription Management. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
* base: mirror.daniel-jost.net
* epel: mirrors.n-ix.net
* extras: mirror.daniel-jost.net
* ius: mirror.amsiohosting.net
* remi: mirror.23media.de
* remi-php56: mirror.23media.de
* remi-safe: mirror.23media.de
* updates: mirror.daniel-jost.net
No package libapache2-mod-wsgi-py3 available.
Error: Nothing to do
Any suggestions on how to run apache2.4+ mod_wsgi with python3.5 on CentOS 7 are very welcome!
I tried following Carl's answer, but it didn't solve the problem. It turns out that the version I installed required some extra configuration steps after installation.
Background
I looked at Apache's modules folder before I installed the mod_wsgi upgrade:
$ ls -l /lib64/httpd/modules
[...]
-rwxr-xr-x. 1 root root 172800 Oct 30 22:44 mod_wsgi.so
Then I installed the SCL repository, and looked to see which versions of mod_wsgi are available.
$ sudo yum install -q -y centos-release-scl
[...]
$ yum search mod_wsgi
[...]
koschei-frontend.noarch : Web frontend for koschei using mod_wsgi
mod_wsgi.x86_64 : A WSGI interface for Python web applications in Apache
python27-mod_wsgi.x86_64 : A WSGI interface for Python web applications in Apache
python33-mod_wsgi.x86_64 : A WSGI interface for Python web applications in Apache
rh-python34-mod_wsgi.x86_64 : A WSGI interface for Python web applications in Apache
rh-python35-mod_wsgi.x86_64 : A WSGI interface for Python web applications in Apache
rh-python36-mod_wsgi.x86_64 : A WSGI interface for Python web applications in Apache
viewvc-httpd-wsgi.noarch : ViewVC configuration for Apache/mod_wsgi
[...]
I'm using Python 3.6, so I installed the matching version and restarted Apache.
$ sudo yum install -q -y rh-python36-mod_wsgi
[...]
$ sudo systemctl restart httpd
Sadly, that didn't solve the problem. When I looked in Apache's modules folder, nothing had changed. Weird!
$ ls -l /lib64/httpd/modules
[...]
-rwxr-xr-x. 1 root root 172800 Oct 30 22:44 mod_wsgi.so
So what did get installed?
$ rpm -ql rh-python36-mod_wsgi
/opt/rh/httpd24/root/etc/httpd/conf.modules.d/10-rh-python36-wsgi.conf
/opt/rh/httpd24/root/usr/lib64/httpd/modules/mod_rh-python36-wsgi.so
/opt/rh/rh-python36/root/usr/share/doc/rh-python36-mod_wsgi-4.5.18
/opt/rh/rh-python36/root/usr/share/doc/rh-python36-mod_wsgi-4.5.18/CREDITS.rst
/opt/rh/rh-python36/root/usr/share/doc/rh-python36-mod_wsgi-4.5.18/LICENSE
/opt/rh/rh-python36/root/usr/share/doc/rh-python36-mod_wsgi-4.5.18/README.rst
Extra Configuration Steps
It installed the files I need, but it didn't put them anywhere useful. With some hints from the README.rst file, I copied them into the right place.
sudo cp /opt/rh/httpd24/root/usr/lib64/httpd/modules/mod_rh-python36-wsgi.so /lib64/httpd/modules
sudo cp /opt/rh/httpd24/root/etc/httpd/conf.modules.d/10-rh-python36-wsgi.conf /etc/httpd/conf.modules.d
sudo systemctl restart httpd
Now I have the right version of mod_wsgi, and my Django app will run under Apache.
I see you already have the IUS repo enabled. Rather than jumping through SCL hoops, you can just install a normal package.
yum install python35u-mod_wsgi
This will use standard filesystem locations to work with stock Apache HTTPD 2.4.
/etc/httpd/conf.modules.d/10-wsgi-python3.5.conf
/usr/lib64/httpd/modules/mod_wsgi_python3.5.so
Have you check the rh-python35 Software Collection which provides a rh-python35-mod_wsgi package ?
More information about SCL, see:
The Software Collection (SCL) Repository
The Software Collection Special Interest Group
RHSCL 2.3 release announcement
I would use the SCL packages for python 3.6 (though feel free to substitute 3.5 below).
To start:
yum install centos-release-scl
yum install rh-python36 rh-python36-mod_wsgi
Note that will bring in the SCL package httpd24-httpd and put the mod_wsgi file in that installation. I would recommend you use that installation and not install the base CentOS httpd package. At time of writing, for CentOS 7, the httpd package is 2.4.6 and the httpd24-httpd package is 2.4.37.
Then you create a virtualenv with:
/opt/rh/rh-python36/root/usr/bin/python -m venv /path/to/venv36
source /path/to/venv36/bin/activate
pip install ...
Now you can put the config for your site in /opt/rh/httpd24/root/etc/httpd/conf.d/mysite.conf, which could contain something like:
<VirtualHost *:80>
LoadModule wsgi_module modules/mod_wsgi.so
ErrorLog /var/log/httpd24/mysite-err.log
CustomLog /var/log/httpd24/mysite.log combined
# recommended way of setting DJANGO_SETTINGS_MODULE http://stackoverflow.com/a/25496668/3189
WSGIProcessGroup mysite.settings.production
WSGIDaemonProcess mysite.settings.production python-path=/path/to/mysite/:/path/to/venv36/lib/python3.6/site-packages
WSGIScriptAlias / /path/to/mysite/wsgi.py process-group=mysite application-group=%{GLOBAL}
</VirtualHost>
Now you start the SCL apache with:
systemctl start httpd24-httpd
And your site should be working.

Apache is viewing php files as texts

After I updated to php7.0 now it's viewing the files, I firstly thought it was in apache itself, but i have reinstalled it, what could be the problem..?
ubuntu 15.04
Install PHP 7 and the Apache PHP module as follows:
apt-get -y install php7.0 libapache2-mod-php7.0
Then restart Apache:
service apache2 restart
Another possible reason could be short open tag. Configure php.ini files related line as: short_open_tag = On and restart php service.

Do I need to uninstall apache httpd before installing tomcat?

I did sudo yum groupinstall -y "Web Server" "PHP Support", on my ec2 instance. Now I want to install apache tomcat. Do I need to uninstall httd that was installed as a part of yum groupinstall -y "Web Server" ? If yes, why ?
Although I never done it myself: no you don't have to uninstall httpd. I've seen them running next to eachother in the past. You do need to change the configuration of course since both can't listen to default port 80. :)