Click here for "Error Codes for Commercial Air Conditioners".

CentOS7.6 WEB Server Deployment 

1.Install Apache httpd 2.4

Install a web server (Apache2.4) to display the web site.

Installation Requirements
♦Use the latest version of Apache 2.4, 2.4.41
♦Install Apache in /usr/local/src (the standard installation directory as is customary for Linux when installing from source)
♦Installation directory for documents to be published on the Web /var/www/html/
♦Using Virtual Hosts

Before installing Apache, install the necessary libraries.

1.1  Install APR, APR-util, and expat-devel

①Install APR (latest version is 1.7.0)

# cd /usr/local/src
# wget http://ftp.riken.jp/net/apache/apr/apr-1.7.0.tar.gz
# tar -xvzf apr-1.7.0.tar.gz
# cd apr-1.7.0
# ./configure –prefix=/opt/apr/apr-1.7.0   ← installation directory
# make
# make test
# make install

②Install APR-util (latest version is 1.6.1)

# cd /usr/local/src
# wget http://ftp.jaist.ac.jp/pub/apache//apr/apr-util-1.6.1.tar.gz
# tar -xvzf apr-util-1.6.1.tar.gz
# cd apr-util-1.6.1
# ./configure –prefix=/opt/apr-util/apr-util-1.6.1 –with-apr=/opt/apr/apr-1.7.0
# make
# make test
# make install

③Install expat-devel
When compiling apr-util 1.6.0, if you have not installed the “expat-devel” package, you may get the following error.

xml/apr_xml.lo -c xml/apr_xml.c && touch xml/apr_xml.lo
xml/apr_xml.c:35:19: fatal error: expat.h: There are no such files or directories.
#include <expat.h>
Stopped compiling.。 make[1]: *** [xml/apr_xml.lo] error 1
make[1]: directory`/usr/local/src/apr-util-1.6.0′ It’s coming from
make: *** [all-recursive] error 1

# cd /usr/local/src
# wget http://mirror.centos.org/centos/7/os/x86_64/Packages/expat-devel-2.1.0-10.el7_3.x86_64.rpm
# rpm -Uvh expat-devel-2.1.0-10.el7_3.x86_64.rpm

1.2 Install Apache 2.4 (latest version is 2.4.41)

Downloading and Deploying Apache 2.4
# cd /usr/local/src

# wget http://ftp.kddilabs.jp/infosystems/apache//httpd/httpd-2.4.41.tar.gz
# tar -xvzf httpd-2.4.41.tar.gz
Compiling and installing
# cd /usr/local/src/httpd-2.4.41
./configure \
–with-layout=Apache \ ← Where to install Apache
–enable-module=auth_db \ ← Activate the required modules.
–enable-module=so \ ← Activate the required modules.
–enable-module=most \ ← Activate the required modules.
–enable-mods-shared=reallyall \ ← Activate the required modules.
–enable-rewrite \ ← Activate the required modules.
–enable-auth_digest ← Activate the required modules.
# make
# make instal

Typical Examples of Apache Compilation and Installation Options
Options for Apache Installation

OptionDetails
–with-layout=[F:]IDUse the installation path layout ID obtained from file F
–target=TARGETInstall the associated file using the name specified in TARGET
–prefix=PREFIXInstall Apache (command) in the directory specified by PREFIX.
–exec-prefix=EPREFIXInstall httpd (daemon) in the directory specified by EPREFIX.
–bindir=DIRSpecify the bin directory by DIR
–sbindir=DIRSpecify the sbin directory by DIR
–libexecdir=DIRSpecify the libexec directory by DIR
–mandir=DIRInstall man (manual) in the directory specified by DIR.
–sysconfdir=DIRInstall the configuration file in the directory specified by DIR.
–datadir=DIRInstall the data files in the directory specified by DIR.
–iconsdir=DIRInstall the icon files in the directory specified by DIR.
–htdocsdir=DIRSet the directory specified by DIR as a document file (index to be published via http).
–cgidir=DIRSet the directory specified by DIR as the CGI directory.
–includedir=DIRInstall the include files in the directory specified by DIR.
–localstatedir=DIRInstall the modifiable data files in the directory specified by DIR
–runtimedir=DIRInstall the runtime data in the directory specified by DIR.
–logfiledir=DIRInstall the log file in the directory specified by DIR.
–proxycachedir=DIRInstall the proxy cache data in the directory specified by DIR

⑤Configuring Apache (editing httpd.conf)
Whole apache configuration
Range-specified configuration (per directory, file, path, etc.)
The range specification is done in a section container, and the settings outside the section container become the overall apache settings.
The following range of <Directory “/usr/local/apache2/htdocs”>~</Directory> is the section container.

In httpd.conf.
# Specify by directory — <Directory>
# Specify by file — <Files>
# Specify by path — <Location>
# Load other configuration files — Include

<Directory “/usr/local/apache2/htdocs”>
# Setting contents
Options Indexes FollowSymLinks

AllowOverride None
Order allow,deny
Allow from all
</Directory>

# vi /usr/local/apache2/conf/httpd.conf

Enable digest authentication
LoadModule auth_digest_module modules/mod_auth_digest.so
CGI Enable the module (uncomment it out)
#LoadModule cgid_module modules/mod_cgid.so
→ LoadModule cgid_module modules/mod_cgid.so
Change the document root (default setting is as shown in the following, but you can comment it out and continue with the default setting if you wish).
# DocumentRoot “/usr/local/apache2/htdocs”

ServerAdmin Email address


ServerName  host name
Add an index file
DirectoryIndex index.html index.htm index.php
Virtual Host Configuration
<VirtualHost *:80>
ServerAdmin Email address
ServerName Domain Name

DocumentRoot “/var/www/html/Domain Name”
ErrorLog /var/log/httpd/Domain Name_error.log
CustomLog /var/log/httpd/Domain Name_access.log combined
AddDefaultCharset UTF-8
<Directory “/var/www/Domain Name/”>
AllowOverride All
Require all granted

</Directory>
</VirtualHost>
Enable CGI scripts (uncomment them)
#AddHandler cgi-script .cgi → Enable AddHandler cgi-script .cgihttpd-default.conf
#Include conf/extra/httpd-default.conf → Include conf/extra/httpd-default.conf

⑥Create a web publishing directory

# mkdir -p /var/www/html/Domain Name/

⑦Automatic start-up setting

# systemctl enable httpd

You now have a minimum of Apache installed.

2.PHP7 Installation

2.1. Download and install the required libraries.

Download
# wget http://mirror.centos.org/centos/7/os/x86_64/Packages/xz-devel-5.2.2-1.el7.x86_64.rpm
# wget http://mirror.centos.org/centos/7/os/x86_64/Packages/libxml2-devel-2.9.1-6.el7_2.3.x86_64.rpm
# wget
fftp://ftp.pbone.net/mirror/ftp.scientificlinux.org/linux/scientific/7.0/x86_64/updates/security/libjpeg-turbo-devel-1.2.90-6.el7.x86_64.rpm
# wget http://mirror.centos.org/centos/7/os/x86_64/Packages/libpng-devel-1.5.13-7.el7_2.x86_64.rpm
# wget http://mirror.centos.org/centos/7/os/x86_64/Packages/freetype-2.8-14.el7.x86_64.rpm
# wget http://mirror.centos.org/centos/7/os/x86_64/Packages/freetype-devel-2.8-14.el7.x86_64.rpm
# wget http://mirror.centos.org/centos/7/os/x86_64/Packages/libcurl-devel-7.29.0-54.el7.x86_64.rpm
・・・・・・・・・・・・・・・・・
Install
# rpm -Uvh  xz-devel-5.2.2-1.el7.x86_64.rpm libxml2-devel-2.9.1-6.el7_2.3.x86_64.rpm libjpeg-turbo-devel-1.2.90-6.el7.x86_64.rpm libpng-devel-1.5.13-7.el7_2.x86_64.rpm freetype-2.8-14.el7.x86_64.rpm freetype-devel-2.8-14.el7.x86_64.rpm libcurl-devel-7.29.0-54.el7.x86_64.rpm

2.2 Download and install PHP

# wget https://www.php.net/distributions/php-7.3.6.tar.gz
# tar zxvf php-7.3.6.tar.gz
# cd php-7.3.6
# ./configure \
–prefix=/usr/local/php7 \ ← Where to install php7
–with-config-file-path=/usr/local/php7/etc \ ← Location of the php configuration file
–with-apxs2=/usr/local/apache2/bin/apxs \
–enable-mbstring \
–enable-mbregex \
–with-gd \
–enable-gd-jis-conv \
–with-freetype-dir=/usr \
–with-png-dir=/usr \
–with-zlib \
–with-jpeg-dir=/usr \
–with-mysqli=mysqlnd \
–with-mysql-sock=/var/lib/mysql/mysql.sock \
–with-curl
# make
# make install

2.3 Edit Apache configuration file to work with Apache

Associates the extension (.php) used in PHP with PHP. By registering, when a file with the extension (.php) is accessed, the result of the execution using PHP will be returned to the client. Put the following at the end of the “httpd.conf” file

AddType application/x-httpd-php .php

2.4 Edit PHP configuration file

# vi /usr/local/etc/php.ini
・・・・・・・・・・
Add the following to the end
extension=curl.so
extension=openssl.so
date.timezone = Asia/Tokyo

 

タイトルとURLをコピーしました