Settu upp Plesk á CentOS 7
Að nota annað kerfi? Plesk er sérstakt stjórnborð fyrir vefþjón sem gerir notendum kleift að stjórna persónulegum og/eða viðskiptavinum vefsíðum sínum, gagnagrunnum
H2O er ný kynslóð HTTP netþjóns sem hefur frábæra, fullkomlega HTTP/2 útfærslu á öllum núverandi vefþjónum sem eru í notkun. Með H2O sem vefþjóninn þinn geturðu nýtt þér nýja eiginleika HTTP/2 forskriftarinnar, eins og töf fínstillingu, netþjóns-push og forgangsröðun á netþjóni sem getur nýtt þér nútíma vafraeiginleika sem sjaldan er talað um.
Í þessari ítarlegu kennslu mun ég sýna þér skref fyrir skref hvernig á að koma H2O í gang á CentOS 7 x64 tilvikinu þínu.
Skráðu þig inn í gegnum SSH með skilríkjunum sem finnast undir tilvikinu þínu og uppfærðu kerfið sem hér segir.
sudo yum install epel-release -y
sudo yum clean all && sudo yum update -y
Til þess að setja upp H2O á CentOS 7 verður þú að bæta við Bintray RPM geymslunni til að setja upp forbyggðu H2O tvöfaldana. Notaðu Nano ritstjórann til að búa til sérsniðna endursölu.
sudo nano /etc/yum.repos.d/bintray-h2o-rpm.repo
Afritaðu og límdu textann hér að neðan í endursöluskrána.
[bintray-h2o-rpm]
name=bintray-h2o-rpm
baseurl=https://dl.bintray.com/tatsushid/h2o-rpm/centos/$releasever/$basearch/
gpgcheck=0
repo_gpgcheck=0
enabled=1
Næst skaltu setja upp H2O.
sudo yum install h2o -y
Nú þegar H2O er uppsett, en áður en þú virkjar og ræsir þjónustuna, þarf rétta uppsetningu og við þurfum að búa til ákveðinn notanda og hóp fyrir H2O til að keyra undir. Búðu til hóp og notanda fyrir H2O til að keyra undir nafninu h2o
.
sudo groupadd -g 101 h2o
sudo useradd -d /etc/h2o -g 101 -M -s /sbin/nologin -u 101 h2o
Eftirfarandi skref munu gefa dæmi um uppsetningaruppsetningar fyrir ýmsar unencrypted
, encrypted
, static
og dynamic
netþjónauppsetningar; sem og sambland af öllum fjórum.
http://www.example.com
til http://example.com
(Static HTML Pages, Engin PHP) stillingarFarðu í /etc/h2o/
möppuna.
cd /etc/h2o/
Endurnefna sjálfgefið h2o.conf
í h2o.conf.original
.
sudo mv h2o.conf h2o.conf.original
Búðu til nýja h2o.conf
skrá.
sudo nano h2o.conf
Afritaðu og límdu textann fyrir neðan í h2o.conf
skrána.
access-log: /var/log/h2o/access.log
compress: ON
error-log: /var/log/h2o/error.log
expires: 1 day
file.index: [ 'index.html' ]
hosts:
"example.com:80":
listen:
port: 80
paths:
"/":
file.dir: /var/www/example.com
"www.example.com:80":
listen:
port: 80
paths:
"/":
redirect:
status: 301
url: "http://example.com/"
pid-file: /var/run/h2o/h2o.pid
send-server-name: OFF
setenv:
HTTP_PROXY: ""
user: h2o
Virkjaðu og ræstu H2O netþjóninn.
sudo systemctl enable h2o
sudo systemctl start h2o
Búðu til sjálfgefið index.html
með því að nota sniðmátið í /var/www/html
möppuvalkostinn sem file.dir
talinn er upp hér að ofan í /var/www/example.com
.
sudo cp -var /var/www/html /var/www/example.com
Opnaðu nú vafrann þinn og sláðu inn lén netþjónsins ( example.com
eða www.example.com
) til dæmis. Ertu að fá skilaboð Unable to connect
eða This site can’t be reached
skilaboð? Sjálfgefin eldveggstilling CentOS leyfir komandi tengingar við http tengið. Framkvæmdu eftirfarandi til að opna það.
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --reload
Endurnýjaðu síðuna í vafranum þínum ( F5
) og þú munt fá þessi skilaboð.
Welcome to H2O - an optimized HTTP server
It works!
http://example.com
til http://www.example.com
(Static HTML Pages, Engin PHP) stillingarFarðu í /etc/h2o/
möppuna.
cd /etc/h2o/
Endurnefna sjálfgefið h2o.conf
í h2o.conf.original
.
sudo mv h2o.conf h2o.conf.original
Búðu til nýja h2o.conf
skrá.
sudo nano h2o.conf
Afritaðu og límdu eftirfarandi texta inn í h2o.conf
skrána.
access-log: /var/log/h2o/access.log
compress: ON
error-log: /var/log/h2o/error.log
expires: 1 day
file.index: [ 'index.html' ]
hosts:
"example.com:80":
listen:
port: 80
paths:
"/":
redirect:
status: 301
url: "http://www.example.com/"
"www.example.com:80":
listen:
port: 80
paths:
"/":
file.dir: /var/www/www.example.com
pid-file: /var/run/h2o/h2o.pid
send-server-name: OFF
setenv:
HTTP_PROXY: ""
user: h2o
Virkjaðu og ræstu H2O netþjóninn.
sudo systemctl enable h2o
sudo systemctl start h2o
Búðu til sjálfgefna index.html
skrá með því að nota sniðmátið í /var/www/html
möppuvalkostinn sem file.dir
talinn er upp hér að ofan í /var/www/www.example.com
.
sudo cp -var /var/www/html /var/www/www.example.com
Opnaðu nú vafrann þinn og sláðu inn lén netþjónsins ( example.com
eða www.example.com
) til dæmis. Ertu að fá skilaboð Unable to connect
eða This site can’t be reached
skilaboð? Sjálfgefin eldveggstilling CentOS leyfir komandi tengingar við http tengið. Gerðu eftirfarandi til að opna það.
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --reload
Endurnýjaðu síðuna í vafranum þínum ( F5
) og þú munt fá þessi skilaboð.
Welcome to H2O - an optimized HTTP server
It works!
http://www.example.com
Til http://example.com
(Dynamic Page, PHP-FPM 5.6.x) StillingarFarðu í /etc/h2o/
möppuna.
cd /etc/h2o/
Endurnefna sjálfgefið h2o.conf
í h2o.conf.original
.
sudo mv h2o.conf h2o.conf.original
Búðu til nýja h2o.conf
skrá.
sudo nano h2o.conf
Afritaðu og límdu eftirfarandi texta inn í h2o.conf
skrána.
access-log: /var/log/h2o/access.log
compress: ON
error-log: /var/log/h2o/error.log
expires: 1 day
file.index: [ 'index.php' ]
hosts:
"example.com:80":
listen:
port: 80
paths:
"/":
file.dir: /var/www/example.com
redirect:
internal: YES
status: 307
url: /index.php
"www.example.com:80":
listen:
port: 80
paths:
"/":
redirect:
status: 301
url: "http://example.com/"
file.custom-handler:
extension: .php
fastcgi.connect:
port: /run/php-fpm-5.6.sock
type: unix
pid-file: /var/run/h2o/h2o.pid
send-server-name: OFF
setenv:
HTTP_PROXY: ""
user: h2o
In order to process PHP, the PHP-FPM 5.6 daemon must be installed and configured. In order to install a version of PHP-FPM newer than the default 5.4.x, the REMI repo must be installed which contains PHP versions 5.6.x, 7.0.x and 7.1.x. Install PHP version 5.6.x.
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
sudo yum install php56-php-fpm -y
Navigate to the /opt/remi/php56/root/etc/
directory.
cd /opt/remi/php56/root/etc/
Rename the default php-fpm.conf
to php-fpm.conf.original
.
sudo mv php-fpm.conf php-fpm.conf.original
Create a new php-fpm.conf
file.
sudo nano php-fpm.conf
Copy and paste the text below into the php-fpm.conf
file.
include=/opt/remi/php56/root/etc/php-fpm.d/*.conf
[global]
daemonize = yes
emergency_restart_threshold = 2
emergency_restart_interval = 1m
error_log = /var/log/php-fpm/php-fpm-5.6-error.log
pid = /var/run/php-fpm-5.6.pid
process_control_timeout = 10s
Rename the default www.conf
file in the php-fpm.d
directory.
sudo mv php-fpm.d/www.conf php-fpm.d/www.conf.original
Create a new www.conf
file.
sudo nano php-fpm.d/www.conf
Copy and paste the text below into the www.conf
file. Change your pm.max\_children
to match the number of CPUs in accordance with your VPS instance.
[www]
group = h2o
listen = /var/run/php-fpm-5.6.sock
listen.backlog = 65536
listen.owner = h2o
listen.group = h2o
pm = static
pm.max_children = 2
pm.max_requests = 10240
user = h2o
Rename the default php.ini
file.
sudo mv php.ini php.ini.original
Create a new php.ini
file.
sudo nano php.ini
Copy and paste the text below into the new php.ini file
. Change the memory\_limit
, post\_max\_size
, upload\_max\_filesize
and date.timezone
in accordance with your VPS instance.
[PHP]
allow_url_fopen = On
always_populate_raw_post_data = -1
display_errors = Off
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
expose_php = Off
log_errors = On
memory_limit = 256M
output_buffering = 4096
post_max_size = 64M
register_argc_argv = Off
request_order = "GP"
upload_max_filesize = 64M
variables_order = "GPCS"
[Date]
date.timezone = America/New_York
[Session]
session.cache_limiter =
session.gc_divisor = 1000
session.hash_bits_per_character = 5
session.save_handler = files
session.save_path = "/opt/remi/php56/root/var/lib/php/session/"
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
Change the group ownership for the /opt/remi/php56/root/var/lib/php/session/
directory from the apache
group to the h2o
group.
sudo chown root.h2o /opt/remi/php56/root/var/lib/php/session/
Create a directory where the PHP-FPM server logs will reside.
sudo mkdir /var/log/php-fpm/
Enable and start the PHP-FPM server.
sudo systemctl enable php56-php-fpm
sudo systemctl start php56-php-fpm
Enable and start the H2O server.
sudo systemctl enable h2o
sudo systemctl start h2o
Create a directory where the default index.php
will reside listed by the directory option file.dir
above in /var/www/example.com
.
sudo mkdir /var/www/example.com
Create a default index.php
using the phpinfo
command to test PHP.
sudo nano /var/www/example.com/index.php
Copy and paste the text below in the new index.php
file.
<?php
phpinfo();
?>
Now, open your browser and enter the server domain name (example.com
or www.example.com
) for your instance. Are you getting an Unable to connect
or a This site can’t be reached
message? CentOS's default firewall setting disallows incoming connections to the http port. Do the following to open it.
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --reload
Refresh the page in your browser (F5
) and you will get the standard PHP info page.
http://example.com
To http://www.example.com
(Dynamic Page, PHP-FPM 5.6.x) ConfigurationNavigate to the /etc/h2o/
directory.
cd /etc/h2o/
Rename the default h2o.conf
to h2o.conf.original
.
sudo mv h2o.conf h2o.conf.original
Create a new h2o.conf
file.
sudo nano h2o.conf
Copy and paste the text below into the h2o.conf
file.
access-log: /var/log/h2o/access.log
compress: ON
error-log: /var/log/h2o/error.log
expires: 1 day
file.index: [ 'index.php' ]
hosts:
"example.com:80":
listen:
port: 80
paths:
"/":
redirect:
status: 301
url: "http://www.example.com/"
"www.example.com:80":
listen:
port: 80
paths:
"/":
file.dir: /var/www/www.example.com
redirect:
internal: YES
status: 307
url: /index.php
file.custom-handler:
extension: .php
fastcgi.connect:
port: /run/php-fpm-5.6.sock
type: unix
pid-file: /var/run/h2o/h2o.pid
send-server-name: OFF
setenv:
HTTP_PROXY: ""
user: h2o
In order to process PHP, the PHP-FPM 5.6 daemon must be installed and configured. In order to install a version of PHP-FPM newer than the default 5.4.x, the REMI repo must be installed which contains PHP versions 5.6.x, 7.0.x and 7.1.x. Type the following commands to install PHP version 5.6.x.
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
sudo yum install php56-php-fpm -y
Navigate to the /opt/remi/php56/root/etc/
directory.
cd /opt/remi/php56/root/etc/
Rename the default php-fpm.conf
to php-fpm.conf.original
.
sudo mv php-fpm.conf php-fpm.conf.original
Create a new php-fpm.conf
file.
sudo nano php-fpm.conf
Copy and paste the text below into the php-fpm.conf
file.
include=/opt/remi/php56/root/etc/php-fpm.d/*.conf
[global]
daemonize = yes
emergency_restart_threshold = 2
emergency_restart_interval = 1m
error_log = /var/log/php-fpm/php-fpm-5.6-error.log
pid = /var/run/php-fpm-5.6.pid
process_control_timeout = 10s
Rename the default www.conf
file in the php-fpm.d
directory.
sudo mv php-fpm.d/www.conf php-fpm.d/www.conf.original
Create a new www.conf
file.
sudo nano php-fpm.d/www.conf
Copy and paste the following text into the www.conf
file. Change your pm.max\_children
to match the number of CPUs in accordance with your VPS instance.
[www]
group = h2o
listen = /var/run/php-fpm-5.6.sock
listen.backlog = 65536
listen.owner = h2o
listen.group = h2o
pm = static
pm.max_children = 2
pm.max_requests = 10240
user = h2o
Rename the default php.ini
file.
sudo mv php.ini php.ini.original
Create a new php.ini
file.
sudo nano php.ini
Copy and paste the following text below into the new php.ini file
. Change the memory\_limit
, post\_max\_size
, upload\_max\_filesize
and date.timezone
in accordance with your VPS instance.
[PHP]
allow_url_fopen = On
always_populate_raw_post_data = -1
display_errors = Off
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
expose_php = Off
log_errors = On
memory_limit = 256M
output_buffering = 4096
post_max_size = 64M
register_argc_argv = Off
request_order = "GP"
upload_max_filesize = 64M
variables_order = "GPCS"
[Date]
date.timezone = America/New_York
[Session]
session.cache_limiter =
session.gc_divisor = 1000
session.hash_bits_per_character = 5
session.save_handler = files
session.save_path = "/opt/remi/php56/root/var/lib/php/session/"
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
Change the group ownership for the /opt/remi/php56/root/var/lib/php/session/
directory from the apache
group to the h2o
group.
sudo chown root.h2o /opt/remi/php56/root/var/lib/php/session/
Create a directory where the PHP-FPM server logs will reside.
sudo mkdir /var/log/php-fpm/
Enable and start the PHP-FPM server.
sudo systemctl enable php56-php-fpm
sudo systemctl start php56-php-fpm
Enable and start the H2O server.
sudo systemctl enable h2o
sudo systemctl start h2o
Create a directory where the default index.php
will reside listed by the directory option file.dir
above in /var/www/www.example.com
.
sudo mkdir /var/www/www.example.com
Create a default index.php
using the phpinfo
command to test PHP.
sudo nano /var/www/www.example.com/index.php
Copy and paste the text below in the new index.php
file.
<?php
phpinfo();
?>
Now, open your browser and enter the server domain name (example.com
or www.example.com
) for your instance. Are you getting an Unable to connect
or a This site can’t be reached
message? CentOS's default firewall setting disallows incoming connections to the http port. Do the following to open it.
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --reload
Refresh the page in your browser (F5
) and you will get the standard PHP info page.
http://www.example.com
To http://example.com
(Dynamic Page, PHP-FPM 7.1.x) ConfigurationNavigate to the /etc/h2o/
directory.
cd /etc/h2o/
Rename the default h2o.conf
to h2o.conf.original
.
sudo mv h2o.conf h2o.conf.original
Create a new h2o.conf
file.
sudo nano h2o.conf
Copy and paste the text below into the h2o.conf
file.
access-log: /var/log/h2o/access.log
compress: ON
error-log: /var/log/h2o/error.log
expires: 1 day
file.index: [ 'index.php' ]
hosts:
"example.com:80":
listen:
port: 80
paths:
"/":
file.dir: /var/www/example.com
redirect:
internal: YES
status: 307
url: /index.php
"www.example.com:80":
listen:
port: 80
paths:
"/":
redirect:
status: 301
url: "http://example.com/"
file.custom-handler:
extension: .php
fastcgi.connect:
port: /run/php-fpm-7.1.sock
type: unix
pid-file: /var/run/h2o/h2o.pid
send-server-name: OFF
setenv:
HTTP_PROXY: ""
user: h2o
In order to process PHP, the PHP-FPM 7.1 daemon must be installed and configured. In order to install a version of PHP-FPM newer than the default 5.4.x, the REMI repo must be installed which contains PHP versions 5.6.x, 7.0.x and 7.1.x. Type the following commands below to install PHP version 7.1.x.
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
sudo yum install php71-php-fpm -y
Navigate to the /etc/opt/remi/php71/
directory.
cd /etc/opt/remi/php71/
Rename the default php-fpm.conf
to php-fpm.conf.original
.
sudo mv php-fpm.conf php-fpm.conf.original
Create a new php-fpm.conf
file.
sudo nano php-fpm.conf
Copy and paste the following text into the php-fpm.conf
file.
include=/etc/opt/remi/php71/php-fpm.d/*.conf
[global]
daemonize = yes
emergency_restart_threshold = 2
emergency_restart_interval = 1m
error_log = /var/log/php-fpm/php-fpm-7.1-error.log
pid = /var/run/php-fpm-7.1.pid
process_control_timeout = 10s
Rename the default www.conf
file in the php-fpm.d
directory.
sudo mv php-fpm.d/www.conf php-fpm.d/www.conf.original
Create a new www.conf
file.
sudo nano php-fpm.d/www.conf
Copy and paste the text below into the www.conf
file. Change your pm.max\_children
to match the number of CPUs in accordance with your VPS instance.
[www]
group = h2o
listen = /var/run/php-fpm-7.1.sock
listen.backlog = 65536
listen.owner = h2o
listen.group = h2o
pm = static
pm.max_children = 2
pm.max_requests = 10240
user = h2o
Rename the default php.ini
file.
sudo mv php.ini php.ini.original
Create a new php.ini
file.
sudo nano php.ini
Copy and paste the text below into the new php.ini file
. Change the memory\_limit
, post\_max\_size
, upload\_max\_filesize
and date.timezone
in accordance with your VPS instance.
[PHP]
allow_url_fopen = On
always_populate_raw_post_data = -1
display_errors = Off
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
expose_php = Off
log_errors = On
memory_limit = 256M
output_buffering = 4096
post_max_size = 64M
register_argc_argv = Off
request_order = "GP"
upload_max_filesize = 64M
variables_order = "GPCS"
[Date]
date.timezone = America/New_York
[Session]
session.cache_limiter =
session.gc_divisor = 1000
session.hash_bits_per_character = 5
session.save_handler = files
session.save_path = "/var/opt/remi/php71/lib/php/session/"
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
Change the group ownership for the /var/opt/remi/php71/lib/php/session/
directory from the apache
group to the h2o
group.
sudo chown root.h2o /var/opt/remi/php71/lib/php/session/
Create a directory where the PHP-FPM server logs will reside.
sudo mkdir /var/log/php-fpm/
Enable and start the PHP-FPM server.
sudo systemctl enable php71-php-fpm
sudo systemctl start php71-php-fpm
Enable and start the H2O server.
sudo systemctl enable h2o
sudo systemctl start h2o
Create a directory where the default index.php
will reside listed by the directory option file.dir
above in /var/www/example.com
.
sudo mkdir /var/www/example.com
Create a default index.php
using the phpinfo
command to test PHP.
sudo nano /var/www/example.com/index.php
Copy and paste the text below in the new index.php
file.
<?php
phpinfo();
?>
Now, open your browser and enter the server domain name (example.com
or www.example.com
) for your instance. Are you getting an Unable to connect
or a This site can’t be reached
message? CentOS's default firewall setting disallows incoming connections to the http port. Do the following to open it.
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --reload
Refresh the page in your browser (F5
) and you will get the standard PHP info page.
http://example.com
To http://www.example.com
(Dynamic Page, PHP-FPM 7.1.x) ConfigurationNavigate to the /etc/h2o/
directory.
cd /etc/h2o/
Rename the default h2o.conf
to h2o.conf.original
.
sudo mv h2o.conf h2o.conf.original
Create a new h2o.conf
file.
sudo nano h2o.conf
Copy and paste the text below into the h2o.conf
file.
access-log: /var/log/h2o/access.log
compress: ON
error-log: /var/log/h2o/error.log
expires: 1 day
file.index: [ 'index.php' ]
hosts:
"example.com:80":
listen:
port: 80
paths:
"/":
redirect:
status: 301
url: "http://www.example.com/"
"www.example.com:80":
listen:
port: 80
paths:
"/":
file.dir: /var/www/www.example.com
redirect:
internal: YES
status: 307
url: /index.php
file.custom-handler:
extension: .php
fastcgi.connect:
port: /run/php-fpm-7.1.sock
type: unix
pid-file: /var/run/h2o/h2o.pid
send-server-name: OFF
setenv:
HTTP_PROXY: ""
user: h2o
In order to process PHP, the PHP-FPM 7.1 daemon must be installed and configured. In order to install a version of PHP-FPM newer than the default 5.4.x, the REMI repo must be installed which contains PHP versions 5.6.x, 7.0.x and 7.1.x. Type the following commands below to install PHP version 7.1.x.
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
sudo yum install php71-php-fpm -y
Navigate to the /etc/opt/remi/php71/
directory.
cd /etc/opt/remi/php71/
Rename the default php-fpm.conf
to php-fpm.conf.original
.
sudo mv php-fpm.conf php-fpm.conf.original
Create a new php-fpm.conf
file.
sudo nano php-fpm.conf
Copy and paste the text below into the php-fpm.conf
file.
include=/etc/opt/remi/php71/php-fpm.d/*.conf
[global]
daemonize = yes
emergency_restart_threshold = 2
emergency_restart_interval = 1m
error_log = /var/log/php-fpm/php-fpm-7.1-error.log
pid = /var/run/php-fpm-7.1.pid
process_control_timeout = 10s
Rename the default www.conf
file in the php-fpm.d
directory.
sudo mv php-fpm.d/www.conf php-fpm.d/www.conf.original
Create a new www.conf
file.
sudo nano php-fpm.d/www.conf
Copy and paste the following text into the www.conf
file. Change your pm.max\_children
to match the number of CPUs in accordance with your VPS instance.
[www]
group = h2o
listen = /var/run/php-fpm-7.1.sock
listen.backlog = 65536
listen.owner = h2o
listen.group = h2o
pm = static
pm.max_children = 2
pm.max_requests = 10240
user = h2o
Rename the default php.ini
file.
sudo mv php.ini php.ini.original
Create a new php.ini
file.
sudo nano php.ini
Copy and paste the following text into the new php.ini file
. Change the memory\_limit
, post\_max\_size
, upload\_max\_filesize
and date.timezone
in accordance with your VPS instance.
[PHP]
allow_url_fopen = On
always_populate_raw_post_data = -1
display_errors = Off
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
expose_php = Off
log_errors = On
memory_limit = 256M
output_buffering = 4096
post_max_size = 64M
register_argc_argv = Off
request_order = "GP"
upload_max_filesize = 64M
variables_order = "GPCS"
[Date]
date.timezone = America/New_York
[Session]
session.cache_limiter =
session.gc_divisor = 1000
session.hash_bits_per_character = 5
session.save_handler = files
session.save_path = "/var/opt/remi/php71/lib/php/session"
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
Change the group ownership for the /var/opt/remi/php71/lib/php/session/
directory from the apache
group to the h2o
group.
sudo chown root.h2o /var/opt/remi/php71/lib/php/session/
Create a directory where the PHP-FPM server logs will reside.
sudo mkdir /var/log/php-fpm/
Enable and start the PHP-FPM server.
sudo systemctl enable php71-php-fpm
sudo systemctl start php71-php-fpm
Enable and start the H2O server.
sudo systemctl enable h2o
sudo systemctl start h2o
Create a directory where the default index.php
will reside listed by the directory option file.dir
above in /var/www/example.com
.
sudo mkdir /var/www/www.example.com
Create a default index.php
using the phpinfo
command to test PHP.
sudo nano /var/www/www.example.com/index.php
Copy and paste the text below in the new index.php
file.
<?php
phpinfo();
?>
Now, open your browser and enter the server domain name (example.com
or www.example.com
) for your instance. Are you getting an Unable to connect
or a This site can’t be reached
message? CentOS's default firewall setting disallows incoming connections to the http port. Do the following to open it.
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --reload
Refresh the page in your browser (F5
) and you will get the standard PHP info page.
http://example.com
, http://www.example.com
, and https://www.example.com
to https://example.com
(Static HTML Pages, No PHP) ConfigurationNavigate to the /etc/h2o/
directory.
cd /etc/h2o/
Rename the default h2o.conf
to h2o.conf.original
.
sudo mv h2o.conf h2o.conf.original
Create a new h2o.conf
file.
sudo nano h2o.conf
Copy and paste the text below into the h2o.conf
file.
access-log: /var/log/h2o/access.log
compress: ON
error-log: /var/log/h2o/error.log
expires: 1 day
file.index: [ 'index.html' ]
hosts:
"example.com:80":
listen:
port: 80
paths:
"/":
redirect:
status: 301
url: "https://example.com/"
"www.example.com:80":
listen:
port: 80
paths:
"/":
redirect:
status: 301
url: "https://www.example.com/"
"example.com:443":
listen:
port: 443
ssl:
<<: !file /etc/h2o/conf.d/ssl.conf
certificate-file: /location/of/certificate/file/fullchain.ext
key-file: /location/of/private/key/file/privkey.ext
paths:
"/":
file.dir: /var/www/example.com
header.add: "strict-transport-security: max-age=31536000; includeSubDomains; preload"
"www.example.com:443":
listen:
port: 443
ssl:
<<: !file /etc/h2o/conf.d/ssl.conf
certificate-file: /location/of/certificate/file/fullchain.ext
key-file: /location/of/private/key/file/privkey.ext
paths:
"/":
header.add: "strict-transport-security: max-age=31536000; includeSubDomains; preload"
redirect:
status: 301
url: "https://example.com/"
pid-file: /var/run/h2o/h2o.pid
send-server-name: OFF
setenv:
HTTP_PROXY: ""
user: h2o
Create a custom directory to store the default SSL options for all websites that use SSL.
sudo mkdir conf.d
Create a new ssl.conf
file.
sudo nano conf.d/ssl.conf
Copy and paste the following text into the ssl.conf
file.
cipher-preference: server
cipher-suite: ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
dh-file: /etc/ssl/h2o/dhparam_2048.pem
Make a directory to store the dhparam_2048.pem
file that will be regenerated daily via a cronjob.
sudo mkdir /etc/ssl/h2o/
Create a new regenerate_dhparam
file.
sudo nano /etc/cron.daily/regenerate_dhparam
Copy and paste the following text into the regenerate_dhparam
file.
#!/bin/bash
cd /etc/ssl/h2o
umask 022
for length in 2048
do
openssl dhparam -out dhparam_$length.tmp $length && mv dhparam_$length.tmp dhparam_$length.pem
chmod 444 dhparam_$length.pem
done
Make the bash file just created executable.
sudo chmod +x /etc/cron.daily/regenerate_dhparam
Execute the bash script for a first run as H2O won't start properly if it's not generated. This will take about a minute or two to generate on first run.
sudo /etc/cron.daily/regenerate_dhparam
Enable and start the H2O server.
sudo systemctl enable h2o
sudo systemctl start h2o
Create a default index.html
using the template in /var/www/html
to the directory option file.dir
listed above in /var/www/example.com
.
sudo cp -var /var/www/html /var/www/example.com
Now, open your browser and enter the server domain name (example.com
or www.example.com
) for your instance. Are you getting an Unable to connect
or a This site can’t be reached
message? CentOS's default firewall setting disallows incoming connections to the http port. Do the following to open it.
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
Refresh the page in your browser (F5
) and you will get this message.
Welcome to H2O - an optimized HTTP server
It works!
http://example.com
, http://www.example.com
, and https://example.com
to https://www.example.com
(Static HTML Pages, No PHP) ConfigurationNavigate to the /etc/h2o/
directory.
cd /etc/h2o/
Rename the default h2o.conf
to h2o.conf.original
.
sudo mv h2o.conf h2o.conf.original
Create a new h2o.conf
file.
sudo nano h2o.conf
Copy and paste the text below into the h2o.conf
file.
access-log: /var/log/h2o/access.log
compress: ON
error-log: /var/log/h2o/error.log
expires: 1 day
file.index: [ 'index.html' ]
hosts:
"example.com:80":
listen:
port: 80
paths:
"/":
redirect:
status: 301
url: "https://example.com/"
"www.example.com:80":
listen:
port: 80
paths:
"/":
redirect:
status: 301
url: "https://www.example.com/"
"example.com:443":
listen:
port: 443
ssl:
<<: !file /etc/h2o/conf.d/ssl.conf
certificate-file: /location/of/certificate/file/fullchain.ext
key-file: /location/of/private/key/file/privkey.ext
paths:
"/":
header.add: "strict-transport-security: max-age=31536000; includeSubDomains; preload"
redirect:
status: 301
url: "https://www.example.com/"
"www.example.com:443":
listen:
port: 443
ssl:
<<: !file /etc/h2o/conf.d/ssl.conf
certificate-file: /location/of/certificate/file/fullchain.ext
key-file: /location/of/private/key/file/privkey.ext
paths:
"/":
file.dir: /var/www/www.example.com
header.add: "strict-transport-security: max-age=31536000; includeSubDomains; preload"
pid-file: /var/run/h2o/h2o.pid
send-server-name: OFF
setenv:
HTTP_PROXY: ""
user: h2o
Create a custom directory to store the default SSL options for all websites that use SSL.
sudo mkdir conf.d
Create a new ssl.conf
file.
sudo nano conf.d/ssl.conf
Copy and paste the following text into the ssl.conf
file.
cipher-preference: server
cipher-suite: ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
dh-file: /etc/ssl/h2o/dhparam_2048.pem
Make a directory to store the dhparam_2048.pem
file that will be regenerated daily via a cronjob.
sudo mkdir /etc/ssl/h2o/
Create a new regenerate_dhparam
file.
sudo nano /etc/cron.daily/regenerate_dhparam
Copy and paste the following text inside of the regenerate_dhparam
file.
#!/bin/bash
cd /etc/ssl/h2o
umask 022
for length in 2048
do
openssl dhparam -out dhparam_$length.tmp $length && mv dhparam_$length.tmp dhparam_$length.pem
chmod 444 dhparam_$length.pem
done
Make the bash file just created executable.
sudo chmod +x /etc/cron.daily/regenerate_dhparam
Execute the bash script for a first run as H2O won't start properly if it's not generated. This will take about a minute or two to generate on first run.
sudo /etc/cron.daily/regenerate_dhparam
Enable and start the H2O server.
sudo systemctl enable h2o
sudo systemctl start h2o
Create a default index.html
using the template in /var/www/html
to the directory option file.dir
listed above in /var/www/www.example.com
.
sudo cp -var /var/www/html /var/www/www.example.com
Now, open your browser and enter the server domain name (example.com
or www.example.com
) for your instance. Are you getting an Unable to connect
or a This site can’t be reached
message? CentOS's default firewall setting disallows incoming connections to the http port. Do the following to open it.
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
Refresh the page in your browser (F5
) and you will get this message.
Welcome to H2O - an optimized HTTP server
It works!
http://example.com
, http://www.example.com
, and https://www.example.com
to https://example.com
(Dynamic Page, PHP-FPM 5.6.x) ConfigurationNavigate to the /etc/h2o/
directory.
cd /etc/h2o/
Rename the default h2o.conf
to h2o.conf.original
.
sudo mv h2o.conf h2o.conf.original
Create a new h2o.conf
file.
sudo nano h2o.conf
Copy and paste the text below into the h2o.conf
file.
access-log: /var/log/h2o/access.log
compress: ON
error-log: /var/log/h2o/error.log
expires: 1 day
file.index: [ 'index.php' ]
hosts:
"example.com:80":
listen:
port: 80
paths:
"/":
redirect:
status: 301
url: "https://example.com/"
"www.example.com:80":
listen:
port: 80
paths:
"/":
redirect:
status: 301
url: "https://www.example.com/"
"example.com:443":
listen:
port: 443
ssl:
<<: !file /etc/h2o/conf.d/ssl.conf
certificate-file: /location/of/certificate/file/fullchain.ext
key-file: /location/of/private/key/file/privkey.ext
paths:
"/":
file.dir: /var/www/example.com
header.add: "strict-transport-security: max-age=31536000; includeSubDomains; preload"
redirect:
internal: YES
status: 307
url: /index.php
"www.example.com:443":
listen:
port: 443
ssl:
<<: !file /etc/h2o/conf.d/ssl.conf
certificate-file: /location/of/certificate/file/fullchain.ext
key-file: /location/of/private/key/file/privkey.ext
paths:
"/":
header.add: "strict-transport-security: max-age=31536000; includeSubDomains; preload"
redirect:
status: 301
url: "https://example.com/"
file.custom-handler:
extension: .php
fastcgi.connect:
port: /run/php-fpm-5.6.sock
type: unix
pid-file: /var/run/h2o/h2o.pid
send-server-name: OFF
setenv:
HTTP_PROXY: ""
user: h2o
Create a custom directory to store the default SSL options for all websites that use SSL.
sudo mkdir conf.d
Create a new ssl.conf
file.
sudo nano conf.d/ssl.conf
Copy and paste the text below into the ssl.conf
file.
cipher-preference: server
cipher-suite: ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
dh-file: /etc/ssl/h2o/dhparam_2048.pem
Make a directory to store the dhparam_2048.pem
file that will be regenerated daily via a cronjob.
sudo mkdir /etc/ssl/h2o/
Create a new regenerate_dhparam
file.
sudo nano /etc/cron.daily/regenerate_dhparam
Copy and paste the following text inside of the regenerate_dhparam
file.
#!/bin/bash
cd /etc/ssl/h2o
umask 022
for length in 2048
do
openssl dhparam -out dhparam_$length.tmp $length && mv dhparam_$length.tmp dhparam_$length.pem
chmod 444 dhparam_$length.pem
done
Make the bash file just created executable.
sudo chmod +x /etc/cron.daily/regenerate_dhparam
Execute the bash script for a first run as H2O won't start properly if it's not generated. This will take about a minute or two to generate on first run.
sudo /etc/cron.daily/regenerate_dhparam
In order to process PHP, the PHP-FPM 5.6 daemon must be installed and configured. In order to install a version of PHP-FPM newer than the default 5.4.x, the REMI repo must be installed which contains PHP versions 5.6.x, 7.0.x and 7.1.x. Type the following commands to install PHP version 5.6.x.
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
sudo yum install php56-php-fpm -y
Navigate to the /opt/remi/php56/root/etc/
directory.
cd /opt/remi/php56/root/etc/
Rename the default php-fpm.conf
to php-fpm.conf.original
.
sudo mv php-fpm.conf php-fpm.conf.original
Create a new php-fpm.conf
file.
sudo nano php-fpm.conf
Copy and paste the following text into the php-fpm.conf
file.
include=/opt/remi/php56/root/etc/php-fpm.d/*.conf
[global]
daemonize = yes
emergency_restart_threshold = 2
emergency_restart_interval = 1m
error_log = /var/log/php-fpm/php-fpm-5.6-error.log
pid = /var/run/php-fpm-5.6.pid
process_control_timeout = 10s
Rename the default www.conf
file in the php-fpm.d
directory.
sudo mv php-fpm.d/www.conf php-fpm.d/www.conf.original
Create a new www.conf
file.
sudo nano php-fpm.d/www.conf
Copy and paste the text below into the www.conf
file. Change your pm.max\_children
to match the number of CPUs in accordance with your VPS instance.
[www]
group = h2o
listen = /var/run/php-fpm-5.6.sock
listen.backlog = 65536
listen.owner = h2o
listen.group = h2o
pm = static
pm.max_children = 2
pm.max_requests = 10240
user = h2o
Rename the default php.ini
file.
sudo mv php.ini php.ini.original
Create a new php.ini
file.
sudo nano php.ini
Copy and paste the text below into the new php.ini file
. Change the memory\_limit
, post\_max\_size
, upload\_max\_filesize
and date.timezone
in accordance with your VPS instance.
[PHP]
allow_url_fopen = On
always_populate_raw_post_data = -1
display_errors = Off
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
expose_php = Off
log_errors = On
memory_limit = 256M
output_buffering = 4096
post_max_size = 64M
register_argc_argv = Off
request_order = "GP"
upload_max_filesize = 64M
variables_order = "GPCS"
[Date]
date.timezone = America/New_York
[Session]
session.cache_limiter =
session.gc_divisor = 1000
session.hash_bits_per_character = 5
session.save_handler = files
session.save_path = "/opt/remi/php56/root/var/lib/php/session/"
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
Change the group ownership for the /opt/remi/php56/root/var/lib/php/session/
directory from the apache
group to the h2o
group.
sudo chown root.h2o /opt/remi/php56/root/var/lib/php/session/
Create a directory where the PHP-FPM server logs will reside.
sudo mkdir /var/log/php-fpm/
Enable and start the PHP-FPM server.
sudo systemctl enable php56-php-fpm
sudo systemctl start php56-php-fpm
Enable and start the H2O server.
sudo systemctl enable h2o
sudo systemctl start h2o
Create a directory where the default index.php
will reside listed by the directory option file.dir
above in /var/www/example.com
.
sudo mkdir /var/www/example.com
Create a default index.php
using the phpinfo
command to test PHP.
sudo nano /var/www/example.com/index.php
Copy and paste the text below in the new index.php
file.
<?php
phpinfo();
?>
Now, open your browser and enter the server domain name (example.com
or www.example.com
) for your instance. Are you getting an Unable to connect
or a This site can’t be reached
message? CentOS's default firewall setting disallows incoming connections to the http port. Do the following to open it.
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
Refresh the page in your browser (F5
) and you will get the standard PHP info page.
http://example.com
, http://www.example.com
, and https://example.com
to https://www.example.com
(Dynamic Page, PHP-FPM 5.6.x) ConfigurationNavigate to the /etc/h2o/
directory.
cd /etc/h2o/
Rename the default h2o.conf
to h2o.conf.original
.
sudo mv h2o.conf h2o.conf.original
Create a new h2o.conf
file.
sudo nano h2o.conf
Copy and paste the text below into the h2o.conf
file.
access-log: /var/log/h2o/access.log
compress: ON
error-log: /var/log/h2o/error.log
expires: 1 day
file.index: [ 'index.php' ]
hosts:
"example.com:80":
listen:
port: 80
paths:
"/":
redirect:
status: 301
url: "https://example.com/"
"www.example.com:80":
listen:
port: 80
paths:
"/":
redirect:
status: 301
url: "https://www.example.com/"
"example.com:443":
listen:
port: 443
ssl:
<<: !file /etc/h2o/conf.d/ssl.conf
certificate-file: /location/of/certificate/file/fullchain.ext
key-file: /location/of/private/key/file/privkey.ext
paths:
"/":
header.add: "strict-transport-security: max-age=31536000; includeSubDomains; preload"
redirect:
status: 301
url: "https://www.example.com/"
"www.example.com:443":
listen:
port: 443
ssl:
<<: !file /etc/h2o/conf.d/ssl.conf
certificate-file: /location/of/certificate/file/fullchain.ext
key-file: /location/of/private/key/file/privkey.ext
paths:
"/":
file.dir: /var/www/www.example.com
header.add: "strict-transport-security: max-age=31536000; includeSubDomains; preload"
redirect:
internal: YES
status: 307
url: /index.php
file.custom-handler:
extension: .php
fastcgi.connect:
port: /run/php-fpm-5.6.sock
type: unix
pid-file: /var/run/h2o/h2o.pid
send-server-name: OFF
setenv:
HTTP_PROXY: ""
user: h2o
Create a custom directory to store the default SSL options for all websites that use SSL.
sudo mkdir conf.d
Create a new ssl.conf
file.
sudo nano conf.d/ssl.conf
Copy and paste the text below into the ssl.conf
file.
cipher-preference: server
cipher-suite: ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
dh-file: /etc/ssl/h2o/dhparam_2048.pem
Make a directory to store the dhparam_2048.pem
file that will be regenerated daily via a cronjob.
sudo mkdir /etc/ssl/h2o/
Create a new regenerate_dhparam
file.
sudo nano /etc/cron.daily/regenerate_dhparam
Copy and paste the following text inside of the regenerate_dhparam
file.
#!/bin/bash
cd /etc/ssl/h2o
umask 022
for length in 2048
do
openssl dhparam -out dhparam_$length.tmp $length && mv dhparam_$length.tmp dhparam_$length.pem
chmod 444 dhparam_$length.pem
done
Make the bash file just created executable.
sudo chmod +x /etc/cron.daily/regenerate_dhparam
Execute the bash script for a first run as H2O won't start properly if it's not generated. This will take about a minute or two to generate on first run.
sudo /etc/cron.daily/regenerate_dhparam
In order to process PHP, the PHP-FPM 5.6 daemon must be installed and configured. In order to install a version of PHP-FPM newer than the default 5.4.x, the REMI repo must be installed which contains PHP versions 5.6.x, 7.0.x and 7.1.x. Type the following commands to install PHP version 5.6.x.
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
sudo yum install php56-php-fpm -y
Navigate to the /opt/remi/php56/root/etc/
directory.
cd /opt/remi/php56/root/etc/
Rename the default php-fpm.conf
to php-fpm.conf.original
.
sudo mv php-fpm.conf php-fpm.conf.original
Create a new php-fpm.conf
file.
sudo nano php-fpm.conf
Copy and paste the text below into the php-fpm.conf
file.
include=/opt/remi/php56/root/etc/php-fpm.d/*.conf
[global]
daemonize = yes
emergency_restart_threshold = 2
emergency_restart_interval = 1m
error_log = /var/log/php-fpm/php-fpm-5.6-error.log
pid = /var/run/php-fpm-5.6.pid
process_control_timeout = 10s
Rename the default www.conf
file in the php-fpm.d
directory.
sudo mv php-fpm.d/www.conf php-fpm.d/www.conf.original
Create a new www.conf
file.
sudo nano php-fpm.d/www.conf
Copy and paste the text below into the www.conf
file. Change your pm.max\_children
to match the number of CPUs in accordance with your VPS instance.
[www]
group = h2o
listen = /var/run/php-fpm-5.6.sock
listen.backlog = 65536
listen.owner = h2o
listen.group = h2o
pm = static
pm.max_children = 2
pm.max_requests = 10240
user = h2o
Rename the default php.ini
file.
sudo mv php.ini php.ini.original
Create a new php.ini
file.
sudo nano php.ini
Copy and paste the following text into the new php.ini file
. Change the memory\_limit
, post\_max\_size
, upload\_max\_filesize
and date.timezone
in accordance with your VPS instance.
[PHP]
allow_url_fopen = On
always_populate_raw_post_data = -1
display_errors = Off
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
expose_php = Off
log_errors = On
memory_limit = 256M
output_buffering = 4096
post_max_size = 64M
register_argc_argv = Off
request_order = "GP"
upload_max_filesize = 64M
variables_order = "GPCS"
[Date]
date.timezone = America/New_York
[Session]
session.cache_limiter =
session.gc_divisor = 1000
session.hash_bits_per_character = 5
session.save_handler = files
session.save_path = "/opt/remi/php56/root/var/lib/php/session/"
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
Change the group ownership for the /opt/remi/php56/root/var/lib/php/session/
directory from the apache
group to the h2o
group.
sudo chown root.h2o /opt/remi/php56/root/var/lib/php/session/
Create a directory where the PHP-FPM server logs will reside.
sudo mkdir /var/log/php-fpm/
Enable and start the PHP-FPM server.
sudo systemctl enable php56-php-fpm
sudo systemctl start php56-php-fpm
Enable and start the H2O server.
sudo systemctl enable h2o
sudo systemctl start h2o
Create a directory where the default index.php
will reside listed by the directory option file.dir
above in /var/www/www.example.com
.
sudo mkdir /var/www/www.example.com
Create a default index.php
using the phpinfo
command to test PHP.
sudo nano /var/www/www.example.com/index.php
Copy and paste the text below in the new index.php
file.
<?php
phpinfo();
?>
Now, open your browser and enter the server domain name (example.com or www.example.com
) for your instance. Are you getting an Unable to connect
or a This site can’t be reached
message? CentOS's default firewall setting disallows incoming connections to the http port. Do the following to open it.
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
Refresh the page in your browser (F5
) and you will get the standard PHP info page.
http://example.com
, http://www.example.com
, and https://www.example.com
to https://example.com
(Dynamic Page, PHP-FPM 7.1.x) ConfigurationNavigate to the /etc/h2o/
directory.
cd /etc/h2o/
Rename the default h2o.conf
to h2o.conf.original
.
sudo mv h2o.conf h2o.conf.original
Create a new h2o.conf
file.
sudo nano h2o.conf
Copy and paste the text below into the h2o.conf
file.
access-log: /var/log/h2o/access.log
compress: ON
error-log: /var/log/h2o/error.log
expires: 1 day
file.index: [ 'index.php' ]
hosts:
"example.com:80":
listen:
port: 80
paths:
"/":
redirect:
status: 301
url: "https://example.com/"
"www.example.com:80":
listen:
port: 80
paths:
"/":
redirect:
status: 301
url: "https://www.example.com/"
"example.com:443":
listen:
port: 443
ssl:
<<: !file /etc/h2o/conf.d/ssl.conf
certificate-file: /location/of/certificate/file/fullchain.ext
key-file: /location/of/private/key/file/privkey.ext
paths:
"/":
file.dir: /var/www/example.com
header.add: "strict-transport-security: max-age=31536000; includeSubDomains; preload"
redirect:
internal: YES
status: 307
url: /index.php
"www.example.com:443":
listen:
port: 443
ssl:
<<: !file /etc/h2o/conf.d/ssl.conf
certificate-file: /location/of/certificate/file/fullchain.ext
key-file: /location/of/private/key/file/privkey.ext
paths:
"/":
header.add: "strict-transport-security: max-age=31536000; includeSubDomains; preload"
redirect:
status: 301
url: "https://example.com/"
file.custom-handler:
extension: .php
fastcgi.connect:
port: /run/php-fpm-7.1.sock
type: unix
pid-file: /var/run/h2o/h2o.pid
send-server-name: OFF
setenv:
HTTP_PROXY: ""
user: h2o
Create a custom directory to store the default SSL options for all websites that use SSL.
sudo mkdir conf.d
Create a new ssl.conf
file.
sudo nano conf.d/ssl.conf
Copy and paste the text below into the ssl.conf
file.
cipher-preference: server
cipher-suite: ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
dh-file: /etc/ssl/h2o/dhparam_2048.pem
Make a directory to store the dhparam_2048.pem
file that will be regenerated daily via a cronjob.
sudo mkdir /etc/ssl/h2o/
Create a new regenerate_dhparam
file.
sudo nano /etc/cron.daily/regenerate_dhparam
Copy and paste the following text inside of the regenerate_dhparam
file.
#!/bin/bash
cd /etc/ssl/h2o
umask 022
for length in 2048
do
openssl dhparam -out dhparam_$length.tmp $length && mv dhparam_$length.tmp dhparam_$length.pem
chmod 444 dhparam_$length.pem
done
Make the bash file just created executable.
sudo chmod +x /etc/cron.daily/regenerate_dhparam
Execute the bash script for a first run as H2O won't start properly if it's not generated. This will take about a minute or two to generate on first run.
sudo /etc/cron.daily/regenerate_dhparam
In order to process PHP, the PHP-FPM 7.1 daemon must be installed and configured. In order to install a version of PHP-FPM newer than the default 5.4.x, the REMI repo must be installed which contains PHP versions 5.6.x, 7.0.x and 7.1.x. Type the following commands below to install PHP version 7.1.x.
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
sudo yum install php71-php-fpm -y
Navigate to the /etc/opt/remi/php71/
directory.
cd /etc/opt/remi/php71/
Rename the default php-fpm.conf
to php-fpm.conf.original
.
sudo mv php-fpm.conf php-fpm.conf.original
Create a new php-fpm.conf
file.
sudo nano php-fpm.conf
Copy and paste the text below into the php-fpm.conf
file.
include=/etc/opt/remi/php71/php-fpm.d/*.conf
[global]
daemonize = yes
emergency_restart_threshold = 2
emergency_restart_interval = 1m
error_log = /var/log/php-fpm/php-fpm-7.1-error.log
pid = /var/run/php-fpm-7.1.pid
process_control_timeout = 10s
Rename the default www.conf
file in the php-fpm.d
directory.
sudo mv php-fpm.d/www.conf php-fpm.d/www.conf.original
Create a new www.conf
file.
sudo nano php-fpm.d/www.conf
Copy and paste the following text into the www.conf
file. Change your pm.max\_children
to match the number of CPUs in accordance with your VPS instance.
[www]
group = h2o
listen = /var/run/php-fpm-7.1.sock
listen.backlog = 65536
listen.owner = h2o
listen.group = h2o
pm = static
pm.max_children = 2
pm.max_requests = 10240
user = h2o
Rename the default php.ini
file.
sudo mv php.ini php.ini.original
Create a new php.ini
file.
sudo nano php.ini
Copy and paste the following text below into the new php.ini file
. Change the memory\_limit
, post\_max\_size
, upload\_max\_filesize
and date.timezone
in accordance with your VPS instance.
[PHP]
allow_url_fopen = On
always_populate_raw_post_data = -1
display_errors = Off
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
expose_php = Off
log_errors = On
memory_limit = 256M
output_buffering = 4096
post_max_size = 64M
register_argc_argv = Off
request_order = "GP"
upload_max_filesize = 64M
variables_order = "GPCS"
[Date]
date.timezone = America/New_York
[Session]
session.cache_limiter =
session.gc_divisor = 1000
session.hash_bits_per_character = 5
session.save_handler = files
session.save_path = "/var/opt/remi/php71/lib/php/session/"
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
Change the group ownership for the /var/opt/remi/php71/lib/php/session/
directory from the apache
group to the h2o
group.
sudo chown root.h2o /var/opt/remi/php71/lib/php/session/
Create a directory where the PHP-FPM server logs will reside.
sudo mkdir /var/log/php-fpm/
Enable and start the PHP-FPM server.
sudo systemctl enable php71-php-fpm
sudo systemctl start php71-php-fpm
Enable and start the H2O server.
sudo systemctl enable h2o
sudo systemctl start h2o
Create a directory where the default index.php
will reside listed by the directory option file.dir
above in /var/www/example.com
.
sudo mkdir /var/www/example.com
Create a default index.php
using the phpinfo
command to test PHP.
sudo nano /var/www/example.com/index.php
Copy and paste the text below in the new index.php
file.
<?php
phpinfo();
?>
Now, open your browser and enter the server domain name (example.com
or www.example.com
) for your instance. Are you getting an Unable to connect
or a This site can’t be reached
message? CentOS's default firewall setting disallows incoming connections to the http port. Do the following to open it.
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
Refresh the page in your browser (F5
) and you will get the standard PHP info page.
http://example.com
, http://www.example.com
, and https://example.com
to https://www.example.com
(Dynamic Page, PHP-FPM 7.1.x) ConfigurationNavigate to the /etc/h2o/
directory.
cd /etc/h2o/
Rename the default h2o.conf
to h2o.conf.original
.
sudo mv h2o.conf h2o.conf.original
Create a new h2o.conf
file.
sudo nano h2o.conf
Copy and paste the text below into the h2o.conf
file.
access-log: /var/log/h2o/access.log
compress: ON
error-log: /var/log/h2o/error.log
expires: 1 day
file.index: [ 'index.php' ]
hosts:
"example.com:80":
listen:
port: 80
paths:
"/":
redirect:
status: 301
url: "https://example.com/"
"www.example.com:80":
listen:
port: 80
paths:
"/":
redirect:
status: 301
url: "https://www.example.com/"
"example.com:443":
listen:
port: 443
ssl:
<<: !file /etc/h2o/conf.d/ssl.conf
certificate-file: /location/of/certificate/file/fullchain.ext
key-file: /location/of/private/key/file/privkey.ext
paths:
"/":
header.add: "strict-transport-security: max-age=31536000; includeSubDomains; preload"
redirect:
status: 301
url: "https://www.example.com/"
"www.example.com:443":
listen:
port: 443
ssl:
<<: !file /etc/h2o/conf.d/ssl.conf
certificate-file: /location/of/certificate/file/fullchain.ext
key-file: /location/of/private/key/file/privkey.ext
paths:
"/":
file.dir: /var/www/www.example.com
header.add: "strict-transport-security: max-age=31536000; includeSubDomains; preload"
redirect:
internal: YES
status: 307
url: /index.php
file.custom-handler:
extension: .php
fastcgi.connect:
port: /run/php-fpm-7.1.sock
type: unix
pid-file: /var/run/h2o/h2o.pid
send-server-name: OFF
setenv:
HTTP_PROXY: ""
user: h2o
Create a custom directory to store the default SSL options for all websites that use SSL.
sudo mkdir conf.d
Create a new ssl.conf
file.
sudo nano conf.d/ssl.conf
Copy and paste the text below into the ssl.conf
file.
cipher-preference: server
cipher-suite: ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
dh-file: /etc/ssl/h2o/dhparam_2048.pem
Make a directory to store the dhparam_2048.pem
file that will be regenerated daily via a cronjob.
sudo mkdir /etc/ssl/h2o/
Create a new regenerate_dhparam
file.
sudo nano /etc/cron.daily/regenerate_dhparam
Copy and paste the following text inside of the regenerate_dhparam
file.
#!/bin/bash
cd /etc/ssl/h2o
umask 022
for length in 2048
do
openssl dhparam -out dhparam_$length.tmp $length && mv dhparam_$length.tmp dhparam_$length.pem
chmod 444 dhparam_$length.pem
done
Make the bash file just created executable.
sudo chmod +x /etc/cron.daily/regenerate_dhparam
Keyrðu bash scriptið í fyrstu keyrslu þar sem H2O byrjar ekki almennilega ef það er ekki búið til. Þetta mun taka um það bil eina eða tvær mínútur að búa til við fyrstu keyrslu.
sudo /etc/cron.daily/regenerate_dhparam
Til þess að vinna með PHP verður PHP-FPM 7.1 púkinn að vera settur upp og stilltur. Til að setja upp útgáfu af PHP-FPM nýrri en sjálfgefna 5.4.x verður að setja upp REMI endurhverfan sem inniheldur PHP útgáfur 5.6.x, 7.0.x og 7.1.x. Sláðu inn eftirfarandi skipanir til að setja upp PHP útgáfu 7.1.x.
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
sudo yum install php71-php-fpm -y
Farðu í /etc/opt/remi/php71/
möppuna.
cd /etc/opt/remi/php71/
Endurnefna sjálfgefið php-fpm.conf
í php-fpm.conf.original
.
sudo mv php-fpm.conf php-fpm.conf.original
Búðu til nýja php-fpm.conf
skrá.
sudo nano php-fpm.conf
Afritaðu og límdu eftirfarandi texta inn í php-fpm.conf
skrána.
include=/etc/opt/remi/php71/php-fpm.d/*.conf
[global]
daemonize = yes
emergency_restart_threshold = 2
emergency_restart_interval = 1m
error_log = /var/log/php-fpm/php-fpm-7.1-error.log
pid = /var/run/php-fpm-7.1.pid
process_control_timeout = 10s
Endurnefna sjálfgefna www.conf
skrá í php-fpm.d
möppunni.
sudo mv php-fpm.d/www.conf php-fpm.d/www.conf.original
Búðu til nýja www.conf
skrá.
sudo nano php-fpm.d/www.conf
Afritaðu og límdu textann fyrir neðan í www.conf
skrána. Breyttu til pm.max\_children
að passa við fjölda örgjörva í samræmi við VPS tilvikið þitt.
[www]
group = h2o
listen = /var/run/php-fpm-7.1.sock
listen.backlog = 65536
listen.owner = h2o
listen.group = h2o
pm = static
pm.max_children = 2
pm.max_requests = 10240
user = h2o
Endurnefna sjálfgefna php.ini
skrá.
sudo mv php.ini php.ini.original
Búðu til nýja php.ini
skrá.
sudo nano php.ini
Afritaðu og límdu eftirfarandi texta fyrir neðan í nýja php.ini file
. Breyttu memory\_limit
, post\_max\_size
, upload\_max\_filesize
og date.timezone
í samræmi við VPS tilvikið þitt.
[PHP]
allow_url_fopen = On
always_populate_raw_post_data = -1
display_errors = Off
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
expose_php = Off
log_errors = On
memory_limit = 256M
output_buffering = 4096
post_max_size = 64M
register_argc_argv = Off
request_order = "GP"
upload_max_filesize = 64M
variables_order = "GPCS"
[Date]
date.timezone = America/New_York
[Session]
session.cache_limiter =
session.gc_divisor = 1000
session.hash_bits_per_character = 5
session.save_handler = files
session.save_path = "/var/opt/remi/php71/lib/php/session"
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
Breyttu eignarhaldi hópsins fyrir /var/opt/remi/php71/lib/php/session/
möppuna úr apache
hópnum í h2o
hópinn.
sudo chown root.h2o /var/opt/remi/php71/lib/php/session/
Búðu til möppu þar sem PHP-FPM miðlaraskrárnar munu vera.
sudo mkdir /var/log/php-fpm/
Virkjaðu og ræstu PHP-FPM þjóninn.
sudo systemctl enable php71-php-fpm
sudo systemctl start php71-php-fpm
Virkjaðu og ræstu H2O netþjóninn.
sudo systemctl enable h2o
sudo systemctl start h2o
Búðu til möppu þar sem sjálfgefið index.php
er skráð af möppuvalkostinum file.dir
hér að ofan í /var/www/example.com
.
sudo mkdir /var/www/www.example.com
Búðu til sjálfgefið index.php
með því að nota phpinfo
skipunina til að prófa PHP.
sudo nano /var/www/www.example.com/index.php
Afritaðu og límdu textann fyrir neðan í nýju index.php
skránni.
<?php
phpinfo();
?>
Opnaðu nú vafrann þinn og sláðu inn lén netþjónsins ( example.com
eða www.example.com
) til dæmis. Ertu að fá skilaboð Unable to connect
eða This site can’t be reached
skilaboð? Sjálfgefin eldveggstilling CentOS leyfir komandi tengingar við http tengið. Gerðu eftirfarandi til að opna það.
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
Endurnýjaðu síðuna í vafranum þínum ( F5
) og þú munt fá staðlaða PHP upplýsingasíðu.
Þetta lýkur kennslunni minni. Takk fyrir að lesa.
Að nota annað kerfi? Plesk er sérstakt stjórnborð fyrir vefþjón sem gerir notendum kleift að stjórna persónulegum og/eða viðskiptavinum vefsíðum sínum, gagnagrunnum
Smokkfiskur er vinsælt, ókeypis Linux forrit sem gerir þér kleift að búa til framsendingarforrit á vefnum. Í þessari handbók muntu sjá hvernig á að setja upp Squid á CentOS til að snúa þér
Inngangur Lighttpd er gaffal af Apache sem miðar að því að vera miklu minna auðlindafrekt. Hann er léttur, þess vegna heitir hann, og er frekar einfaldur í notkun. Uppsetning
VULTR hefur nýlega gert breytingar á enda þeirra og allt ætti nú að virka vel út úr kassanum með NetworkManager virkt. Ef þú vilt slökkva á
Icinga2 er öflugt eftirlitskerfi og þegar það er notað í aðal-viðskiptavinamódel getur það komið í stað þörf fyrir NRPE-undirstaða vöktunareftirlit. Húsbóndinn
Að nota annað kerfi? Apache Cassandra er ókeypis og opinn uppspretta NoSQL gagnagrunnsstjórnunarkerfi sem er hannað til að veita sveigjanleika, háan
Að nota annað kerfi? Microweber er opinn uppspretta draga og sleppa CMS og netverslun. Microweber frumkóði er hýst á GitHub. Þessi handbók mun sýna þér
Að nota annað kerfi? Mattermost er opinn uppspretta, sjálfhýst valkostur við Slack SAAS skilaboðaþjónustuna. Með öðrum orðum, með Mattermost, þú ca
Það sem þú þarft Vultr VPS með að minnsta kosti 1GB af vinnsluminni. SSH aðgangur (með rót / stjórnunarréttindi). Skref 1: Uppsetning BungeeCord Fyrst af öllu
Plesk stjórnborðið er með mjög fallegri samþættingu fyrir Lets Encrypt. Lets Encrypt er ein af einu SSL veitunum sem gefa út skírteini að fullu
Lets Encrypt er vottunaryfirvöld sem sérhæfir sig í að útvega SSL vottorð án endurgjalds. cPanel hefur byggt upp snyrtilega samþættingu svo þú og viðskiptavinurinn þinn
Að nota annað kerfi? Concrete5 er opinn uppspretta CMS sem býður upp á marga áberandi og gagnlega eiginleika til að aðstoða ritstjóra við að framleiða efni auðveldlega og
Að nota annað kerfi? Review Board er ókeypis og opinn hugbúnaður til að skoða frumkóða, skjöl, myndir og margt fleira. Það er vefbundið hugbúnaðarstríð
Í þessari handbók munt þú læra hvernig á að setja upp HTTP auðkenningu fyrir Nginx vefþjón sem keyrir á CentOS 7. Kröfur Til að byrja þarftu að
YOURLS (Your Own URL Shortener) er opinn uppspretta vefslóða styttingar og gagnagreiningarforrit. Í þessari grein munum við fjalla um ferlið við uppsetningu
Using a Different System? Introduction ArangoDB is an open source NoSQL database with a flexible data model for documents, graphs, and key-values. It is
Inngangur /etc/ skrárinn gegnir mikilvægu hlutverki í því hvernig Linux kerfi virkar. Ástæðan fyrir þessu er sú að næstum allar kerfisstillingar
Margir kerfisstjórar stjórna miklu magni af netþjónum. Þegar aðgangur þarf að skrám á mismunandi netþjónum er innskráning á hvern og einn fyrir sig ca
Þessi kennsla mun fjalla um ferlið við að setja upp Half Life 2 leikjaþjón á CentOS 6 System. Skref 1: Forsendur settar upp Til að setja upp ou
Laravel GitScrum, eða GitScrum er opinn uppspretta framleiðniverkfæri hannað til að hjálpa þróunarteymi að innleiða Scrum aðferðafræðina á svipaðan hátt
Gervigreind er ekki í framtíðinni, hún er hér í nútímanum Í þessu bloggi Lestu hvernig gervigreindarforrit hafa haft áhrif á ýmsa geira.
Ertu líka fórnarlamb DDOS árása og ruglaður með forvarnaraðferðirnar? Lestu þessa grein til að leysa spurningar þínar.
Þú gætir hafa heyrt að tölvuþrjótar græða mikið af peningum, en hefur þú einhvern tíma velt því fyrir þér hvernig þeir vinna sér inn svona peninga? við skulum ræða.
Viltu sjá byltingarkenndar uppfinningar frá Google og hvernig þessar uppfinningar breyttu lífi hvers manns í dag? Lestu síðan til að blogga til að sjá uppfinningar frá Google.
Hugmyndin um að sjálfkeyrandi bílar fari á göturnar með hjálp gervigreindar er draumur sem við höfum átt um tíma núna. En þrátt fyrir nokkur loforð eru þau hvergi sjáanleg. Lestu þetta blogg til að læra meira…
Þar sem vísindin þróast hratt og taka yfir mikið af viðleitni okkar, eykst hættan á því að verða fyrir óútskýranlegri einstæðu. Lestu, hvað sérkenni gæti þýtt fyrir okkur.
Geymsluaðferðir gagna hafa verið að þróast gæti verið frá fæðingu gagna. Þetta blogg fjallar um þróun gagnageymslu á grundvelli upplýsingamynda.
Lestu bloggið til að þekkja mismunandi lög í Big Data Architecture og virkni þeirra á einfaldasta hátt.
Í þessum stafræna heimi hafa snjallheimilistæki orðið afgerandi hluti af lífi. Hér eru nokkrir ótrúlegir kostir snjallheimatækja um hvernig þau gera líf okkar þess virði að lifa því og einfaldara.
Nýlega gaf Apple út macOS Catalina 10.15.4 viðbótaruppfærslu til að laga vandamál en svo virðist sem uppfærslan sé að valda fleiri vandamálum sem leiða til múrsteins á Mac vélum. Lestu þessa grein til að læra meira