Cara Memasang Panel Kontrol Hosting Mudah di Ubuntu 16.04
Pelajari langkah-langkah untuk memasang Panel Kontrol Hosting Mudah (EHCP) di Ubuntu 16.04 dengan panduan ini.
H2O adalah server HTTP generasi baru yang memiliki implementasi HTTP / 2 berfitur lengkap dari semua server web saat ini yang digunakan. Dengan H2O sebagai server web Anda, Anda dapat memanfaatkan fitur-fitur baru dari spesifikasi HTTP / 2, seperti optimasi latensi, server-push dan prioritas sisi-server yang dapat memanfaatkan fitur-fitur browser modern yang jarang dibicarakan.
Dalam tutorial terperinci ini, saya akan menunjukkan kepada Anda langkah demi langkah cara menjalankan H2O pada instance CentOS 7 x64 Anda.
Masuk melalui SSH dengan kredensial yang ditemukan di instance Anda dan perbarui sistem sebagai berikut.
sudo yum install epel-release -y
sudo yum clean all && sudo yum update -y
Untuk menginstal H2O pada CentOS 7, Anda harus menambahkan repositori Bintray RPM untuk menginstal biner H2O prebuilt. Gunakan editor Nano untuk membuat repo khusus.
sudo nano /etc/yum.repos.d/bintray-h2o-rpm.repo
Salin dan tempel teks di bawah ini ke dalam file repo.
[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
Selanjutnya, instal H2O.
sudo yum install h2o -y
Sekarang H2O sudah diinstal, tetapi sebelum Anda mengaktifkan dan memulai layanan, konfigurasi yang tepat diperlukan dan kami perlu membuat pengguna dan grup tertentu agar H2O dapat berjalan di bawah. Buat grup dan pengguna untuk menjalankan H2O di bawah bernama h2o.
sudo groupadd -g 101 h2o
sudo useradd -d /etc/h2o -g 101 -M -s /sbin/nologin -u 101 h2o
Langkah-langkah berikut akan memberikan contoh setup konfigurasi untuk berbagai unencrypted, encrypted, staticdan dynamicServer setup; serta kombinasi keempatnya.
http://www.example.comKe http://example.com(Halaman HTML Statis, Tidak Ada PHP)Arahkan ke /etc/h2o/direktori.
cd /etc/h2o/
Ganti nama default h2o.confmenjadi h2o.conf.original.
sudo mv h2o.conf h2o.conf.original
Buat h2o.conffile baru .
sudo nano h2o.conf
Salin dan tempel teks di bawah ini ke dalam h2o.conffile.
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
Aktifkan dan mulai server H2O.
sudo systemctl enable h2o
sudo systemctl start h2o
Buat default index.htmlmenggunakan templat /var/www/htmlke opsi direktori yang file.dirtercantum di dalam /var/www/example.com.
sudo cp -var /var/www/html /var/www/example.com
Sekarang, buka browser Anda dan masukkan nama domain server ( example.comatau www.example.com) untuk instance Anda. Apakah Anda mendapatkan Unable to connectatau This site can’t be reachedpesan? Pengaturan firewall default CentOS melarang koneksi masuk ke port http. Jalankan yang berikut untuk membukanya.
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --reload
Refresh halaman di browser Anda ( F5) dan Anda akan mendapatkan pesan ini.
Welcome to H2O - an optimized HTTP server
It works!
http://example.comKe http://www.example.com(Halaman HTML Statis, Tidak Ada PHP)Arahkan ke /etc/h2o/direktori.
cd /etc/h2o/
Ganti nama default h2o.confmenjadi h2o.conf.original.
sudo mv h2o.conf h2o.conf.original
Buat h2o.conffile baru .
sudo nano h2o.conf
Salin dan tempel teks berikut ke dalam h2o.conffile.
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
Aktifkan dan mulai server H2O.
sudo systemctl enable h2o
sudo systemctl start h2o
Buat index.htmlfile default menggunakan templat /var/www/htmlke opsi direktori yang file.dirtercantum di dalam /var/www/www.example.com.
sudo cp -var /var/www/html /var/www/www.example.com
Sekarang, buka browser Anda dan masukkan nama domain server ( example.comatau www.example.com) untuk instance Anda. Apakah Anda mendapatkan Unable to connectatau This site can’t be reachedpesan? Pengaturan firewall default CentOS melarang koneksi masuk ke port http. Lakukan hal berikut untuk membukanya.
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --reload
Refresh halaman di browser Anda ( F5) dan Anda akan mendapatkan pesan ini.
Welcome to H2O - an optimized HTTP server
It works!
http://www.example.comTo http://example.com(Dynamic Page, PHP-FPM 5.6.x)Arahkan ke /etc/h2o/direktori.
cd /etc/h2o/
Ganti nama default h2o.confmenjadi h2o.conf.original.
sudo mv h2o.conf h2o.conf.original
Buat h2o.conffile baru .
sudo nano h2o.conf
Salin dan tempel teks berikut ke dalam h2o.conffile.
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
Untuk memproses PHP, daemon PHP-FPM 5.6 harus diinstal dan dikonfigurasi. Untuk menginstal versi PHP-FPM yang lebih baru dari versi 5.4.x default, repo REMI harus diinstal yang berisi versi PHP 5.6.x, 7.0.x dan 7.1.x. Instal PHP versi 5.6.x.
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
sudo yum install php56-php-fpm -y
Arahkan ke /opt/remi/php56/root/etc/direktori.
cd /opt/remi/php56/root/etc/
Ganti nama default php-fpm.confmenjadi php-fpm.conf.original.
sudo mv php-fpm.conf php-fpm.conf.original
Buat php-fpm.conffile baru .
sudo nano php-fpm.conf
Salin dan tempel teks di bawah ini ke dalam php-fpm.conffile.
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
Ganti nama www.conffile default di php-fpm.ddirektori.
sudo mv php-fpm.d/www.conf php-fpm.d/www.conf.original
Buat www.conffile baru .
sudo nano php-fpm.d/www.conf
Salin dan tempel teks di bawah ini ke dalam www.conffile. Ubah Anda pm.max\_childrenuntuk mencocokkan jumlah CPU sesuai dengan instance VPS Anda.
[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
Ganti nama php.inifile default .
sudo mv php.ini php.ini.original
Buat php.inifile baru .
sudo nano php.ini
Salin dan tempel teks di bawah ini ke yang baru php.ini file. Mengubah memory\_limit, post\_max\_size, upload\_max\_filesizedan date.timezonesesuai dengan contoh VPS Anda.
[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"
Ubah kepemilikan grup untuk /opt/remi/php56/root/var/lib/php/session/direktori dari apachegrup ke h2ogrup.
sudo chown root.h2o /opt/remi/php56/root/var/lib/php/session/
Buat direktori tempat log server PHP-FPM akan berada.
sudo mkdir /var/log/php-fpm/
Aktifkan dan mulai server PHP-FPM.
sudo systemctl enable php56-php-fpm
sudo systemctl start php56-php-fpm
Aktifkan dan mulai server H2O.
sudo systemctl enable h2o
sudo systemctl start h2o
Buat direktori di mana default index.phpakan berada terdaftar oleh opsi direktori file.dirdi atas /var/www/example.com.
sudo mkdir /var/www/example.com
Buat default index.phpmenggunakan phpinfoperintah untuk menguji PHP.
sudo nano /var/www/example.com/index.php
Salin dan tempel teks di bawah ini di index.phpfile baru .
<?php
phpinfo();
?>
Sekarang, buka browser Anda dan masukkan nama domain server ( example.comatau www.example.com) untuk instance Anda. Apakah Anda mendapatkan Unable to connectatau This site can’t be reachedpesan? Pengaturan firewall default CentOS melarang koneksi masuk ke port http. Lakukan hal berikut untuk membukanya.
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --reload
Refresh halaman di browser Anda ( F5) dan Anda akan mendapatkan halaman info PHP standar.
http://example.comTo http://www.example.com(Dynamic Page, PHP-FPM 5.6.x)Arahkan ke /etc/h2o/direktori.
cd /etc/h2o/
Ganti nama default h2o.confmenjadi h2o.conf.original.
sudo mv h2o.conf h2o.conf.original
Buat h2o.conffile baru .
sudo nano h2o.conf
Salin dan tempel teks di bawah ini ke dalam h2o.conffile.
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
Untuk memproses PHP, daemon PHP-FPM 5.6 harus diinstal dan dikonfigurasi. Untuk menginstal versi PHP-FPM yang lebih baru dari versi 5.4.x default, repo REMI harus diinstal yang berisi versi PHP 5.6.x, 7.0.x dan 7.1.x. Ketik perintah berikut untuk menginstal PHP versi 5.6.x.
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
sudo yum install php56-php-fpm -y
Arahkan ke /opt/remi/php56/root/etc/direktori.
cd /opt/remi/php56/root/etc/
Ganti nama default php-fpm.confmenjadi php-fpm.conf.original.
sudo mv php-fpm.conf php-fpm.conf.original
Buat php-fpm.conffile baru .
sudo nano php-fpm.conf
Salin dan tempel teks di bawah ini ke dalam php-fpm.conffile.
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
Ganti nama www.conffile default di php-fpm.ddirektori.
sudo mv php-fpm.d/www.conf php-fpm.d/www.conf.original
Buat www.conffile baru .
sudo nano php-fpm.d/www.conf
Salin dan tempel teks berikut ke dalam www.conffile. Ubah Anda pm.max\_childrenuntuk mencocokkan jumlah CPU sesuai dengan instance VPS Anda.
[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
Ganti nama php.inifile default .
sudo mv php.ini php.ini.original
Buat php.inifile baru .
sudo nano php.ini
Salin dan tempel teks berikut di bawah ini ke yang baru php.ini file. Mengubah memory\_limit, post\_max\_size, upload\_max\_filesizedan date.timezonesesuai dengan contoh VPS Anda.
[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"
Ubah kepemilikan grup untuk /opt/remi/php56/root/var/lib/php/session/direktori dari apachegrup ke h2ogrup.
sudo chown root.h2o /opt/remi/php56/root/var/lib/php/session/
Buat direktori tempat log server PHP-FPM akan berada.
sudo mkdir /var/log/php-fpm/
Aktifkan dan mulai server PHP-FPM.
sudo systemctl enable php56-php-fpm
sudo systemctl start php56-php-fpm
Aktifkan dan mulai server H2O.
sudo systemctl enable h2o
sudo systemctl start h2o
Buat direktori di mana default index.phpakan berada terdaftar oleh opsi direktori file.dirdi atas /var/www/www.example.com.
sudo mkdir /var/www/www.example.com
Buat default index.phpmenggunakan phpinfoperintah untuk menguji PHP.
sudo nano /var/www/www.example.com/index.php
Salin dan tempel teks di bawah ini di index.phpfile baru .
<?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
Untuk memproses PHP, daemon PHP-FPM 7.1 harus diinstal dan dikonfigurasi. Untuk menginstal versi PHP-FPM yang lebih baru dari versi 5.4.x default, repo REMI harus diinstal yang berisi versi PHP 5.6.x, 7.0.x dan 7.1.x. Ketik perintah berikut di bawah ini untuk menginstal PHP versi 7.1.x.
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
sudo yum install php71-php-fpm -y
Arahkan ke /etc/opt/remi/php71/direktori.
cd /etc/opt/remi/php71/
Ganti nama default php-fpm.confmenjadi php-fpm.conf.original.
sudo mv php-fpm.conf php-fpm.conf.original
Buat php-fpm.conffile baru .
sudo nano php-fpm.conf
Salin dan tempel teks berikut ke dalam php-fpm.conffile.
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
Ganti nama www.conffile default di php-fpm.ddirektori.
sudo mv php-fpm.d/www.conf php-fpm.d/www.conf.original
Buat www.conffile baru .
sudo nano php-fpm.d/www.conf
Salin dan tempel teks di bawah ini ke dalam www.conffile. Ubah Anda pm.max\_childrenuntuk mencocokkan jumlah CPU sesuai dengan instance VPS Anda.
[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
Ganti nama php.inifile default .
sudo mv php.ini php.ini.original
Buat php.inifile baru .
sudo nano php.ini
Salin dan tempel teks di bawah ini ke yang baru php.ini file. Mengubah memory\_limit, post\_max\_size, upload\_max\_filesizedan date.timezonesesuai dengan contoh VPS Anda.
[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"
Ubah kepemilikan grup untuk /var/opt/remi/php71/lib/php/session/direktori dari apachegrup ke h2ogrup.
sudo chown root.h2o /var/opt/remi/php71/lib/php/session/
Buat direktori tempat log server PHP-FPM akan berada.
sudo mkdir /var/log/php-fpm/
Aktifkan dan mulai server PHP-FPM.
sudo systemctl enable php71-php-fpm
sudo systemctl start php71-php-fpm
Aktifkan dan mulai server H2O.
sudo systemctl enable h2o
sudo systemctl start h2o
Buat direktori di mana default index.phpakan berada terdaftar oleh opsi direktori file.dirdi atas /var/www/example.com.
sudo mkdir /var/www/example.com
Buat default index.phpmenggunakan phpinfoperintah untuk menguji PHP.
sudo nano /var/www/example.com/index.php
Salin dan tempel teks di bawah ini di index.phpfile baru .
<?php
phpinfo();
?>
Sekarang, buka browser Anda dan masukkan nama domain server ( example.comatau www.example.com) untuk instance Anda. Apakah Anda mendapatkan Unable to connectatau This site can’t be reachedpesan? Pengaturan firewall default CentOS melarang koneksi masuk ke port http. Lakukan hal berikut untuk membukanya.
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --reload
Refresh halaman di browser Anda ( F5) dan Anda akan mendapatkan halaman info PHP standar.
http://example.comTo http://www.example.com(Dynamic Page, PHP-FPM 7.1.x)Arahkan ke /etc/h2o/direktori.
cd /etc/h2o/
Ganti nama default h2o.confmenjadi h2o.conf.original.
sudo mv h2o.conf h2o.conf.original
Buat h2o.conffile baru .
sudo nano h2o.conf
Salin dan tempel teks di bawah ini ke dalam h2o.conffile.
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();
?>
Sekarang, buka browser Anda dan masukkan nama domain server ( example.comatau www.example.com) untuk instance Anda. Apakah Anda mendapatkan Unable to connectatau This site can’t be reachedpesan? Pengaturan firewall default CentOS melarang koneksi masuk ke port http. Lakukan hal berikut untuk membukanya.
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --reload
Refresh halaman di browser Anda ( F5) dan Anda akan mendapatkan halaman info PHP standar.
http://example.com,, http://www.example.comdan https://www.example.comto https://example.com(Static HTML Pages, No PHP)Arahkan ke /etc/h2o/direktori.
cd /etc/h2o/
Ganti nama default h2o.confmenjadi h2o.conf.original.
sudo mv h2o.conf h2o.conf.original
Buat h2o.conffile baru .
sudo nano h2o.conf
Salin dan tempel teks di bawah ini ke dalam h2o.conffile.
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
Buat direktori khusus untuk menyimpan opsi SSL default untuk semua situs web yang menggunakan SSL.
sudo mkdir conf.d
Buat ssl.conffile baru .
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
Salin dan tempel teks berikut ke dalam ssl.conffile.
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
Buat direktori untuk menyimpan dhparam_2048.pemfile yang akan dibuat ulang setiap hari melalui cronjob.
sudo mkdir /etc/ssl/h2o/
Buat regenerate_dhparamfile baru .
sudo nano /etc/cron.daily/regenerate_dhparam
Salin dan tempel teks berikut di dalam regenerate_dhparamfile.
#!/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
Buat file bash yang baru saja dibuat dapat dieksekusi.
sudo chmod +x /etc/cron.daily/regenerate_dhparam
Jalankan skrip bash untuk menjalankan pertama karena H2O tidak akan mulai dengan benar jika tidak dibuat. Ini akan memakan waktu sekitar satu atau dua menit untuk menghasilkan pada menjalankan pertama.
sudo /etc/cron.daily/regenerate_dhparam
Aktifkan dan mulai server H2O.
sudo systemctl enable h2o
sudo systemctl start h2o
Buat default index.htmlmenggunakan templat /var/www/htmlke opsi direktori yang file.dirtercantum di dalam /var/www/www.example.com.
sudo cp -var /var/www/html /var/www/www.example.com
Sekarang, buka browser Anda dan masukkan nama domain server ( example.comatau www.example.com) untuk instance Anda. Apakah Anda mendapatkan Unable to connectatau This site can’t be reachedpesan? Pengaturan firewall default CentOS melarang koneksi masuk ke port http. Lakukan hal berikut untuk membukanya.
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
Refresh halaman di browser Anda ( F5) dan Anda akan mendapatkan pesan ini.
Welcome to H2O - an optimized HTTP server
It works!
http://example.com,, http://www.example.comdan https://www.example.comke https://example.com(Dynamic Page, PHP-FPM 5.6.x) KonfigurasiArahkan ke /etc/h2o/direktori.
cd /etc/h2o/
Ganti nama default h2o.confmenjadi h2o.conf.original.
sudo mv h2o.conf h2o.conf.original
Buat h2o.conffile baru .
sudo nano h2o.conf
Salin dan tempel teks di bawah ini ke dalam h2o.conffile.
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
Buat direktori khusus untuk menyimpan opsi SSL default untuk semua situs web yang menggunakan SSL.
sudo mkdir conf.d
Buat ssl.conffile baru .
sudo nano conf.d/ssl.conf
Salin dan tempel teks di bawah ini ke dalam ssl.conffile.
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/
Ganti nama default h2o.confmenjadi h2o.conf.original.
sudo mv h2o.conf h2o.conf.original
Buat h2o.conffile baru .
sudo nano h2o.conf
Salin dan tempel teks di bawah ini ke dalam h2o.conffile.
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
Buat direktori khusus untuk menyimpan opsi SSL default untuk semua situs web yang menggunakan SSL.
sudo mkdir conf.d
Buat ssl.conffile baru .
sudo nano conf.d/ssl.conf
Salin dan tempel teks di bawah ini ke dalam ssl.conffile.
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
Buat direktori untuk menyimpan dhparam_2048.pemfile yang akan dibuat ulang setiap hari melalui cronjob.
sudo mkdir /etc/ssl/h2o/
Buat regenerate_dhparamfile baru .
sudo nano /etc/cron.daily/regenerate_dhparam
Salin dan tempel teks berikut di dalam regenerate_dhparamfile.
#!/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
Buat file bash yang baru saja dibuat dapat dieksekusi.
sudo chmod +x /etc/cron.daily/regenerate_dhparam
Jalankan skrip bash untuk menjalankan pertama karena H2O tidak akan mulai dengan benar jika tidak dibuat. Ini akan memakan waktu sekitar satu atau dua menit untuk menghasilkan pada menjalankan pertama.
sudo /etc/cron.daily/regenerate_dhparam
Untuk memproses PHP, daemon PHP-FPM 5.6 harus diinstal dan dikonfigurasi. Untuk menginstal versi PHP-FPM yang lebih baru dari versi 5.4.x default, repo REMI harus diinstal yang berisi versi PHP 5.6.x, 7.0.x dan 7.1.x. Ketik perintah berikut untuk menginstal PHP versi 5.6.x.
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
sudo yum install php56-php-fpm -y
Arahkan ke /opt/remi/php56/root/etc/direktori.
cd /opt/remi/php56/root/etc/
Ganti nama default php-fpm.confmenjadi php-fpm.conf.original.
sudo mv php-fpm.conf php-fpm.conf.original
Buat php-fpm.conffile baru .
sudo nano php-fpm.conf
Salin dan tempel teks di bawah ini ke dalam php-fpm.conffile.
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
Ganti nama www.conffile default di php-fpm.ddirektori.
sudo mv php-fpm.d/www.conf php-fpm.d/www.conf.original
Buat www.conffile baru .
sudo nano php-fpm.d/www.conf
Salin dan tempel teks di bawah ini ke dalam www.conffile. Ubah Anda pm.max\_childrenuntuk mencocokkan jumlah CPU sesuai dengan instance VPS Anda.
[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
Ganti nama php.inifile default .
sudo mv php.ini php.ini.original
Buat php.inifile baru .
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
Salin dan tempel teks di bawah ini ke dalam php-fpm.conffile.
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
Ganti nama www.conffile default di php-fpm.ddirektori.
sudo mv php-fpm.d/www.conf php-fpm.d/www.conf.original
Buat www.conffile baru .
sudo nano php-fpm.d/www.conf
Salin dan tempel teks berikut ke dalam www.conffile. Ubah Anda pm.max\_childrenuntuk mencocokkan jumlah CPU sesuai dengan instance VPS Anda.
[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
Ganti nama php.inifile default .
sudo mv php.ini php.ini.original
Buat php.inifile baru .
sudo nano php.ini
Salin dan tempel teks berikut di bawah ini ke yang baru php.ini file. Mengubah memory\_limit, post\_max\_size, upload\_max\_filesizedan date.timezonesesuai dengan contoh VPS Anda.
[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"
Ubah kepemilikan grup untuk /var/opt/remi/php71/lib/php/session/direktori dari apachegrup ke h2ogrup.
sudo chown root.h2o /var/opt/remi/php71/lib/php/session/
Buat direktori tempat log server PHP-FPM akan berada.
sudo mkdir /var/log/php-fpm/
Aktifkan dan mulai server PHP-FPM.
sudo systemctl enable php71-php-fpm
sudo systemctl start php71-php-fpm
Aktifkan dan mulai server H2O.
sudo systemctl enable h2o
sudo systemctl start h2o
Buat direktori di mana default index.phpakan berada terdaftar oleh opsi direktori file.dirdi atas /var/www/example.com.
sudo mkdir /var/www/example.com
Buat default index.phpmenggunakan phpinfoperintah untuk menguji PHP.
sudo nano /var/www/example.com/index.php
Salin dan tempel teks di bawah ini di index.phpfile baru .
<?php
phpinfo();
?>
Sekarang, buka browser Anda dan masukkan nama domain server ( example.comatau www.example.com) untuk instance Anda. Apakah Anda mendapatkan Unable to connectatau This site can’t be reachedpesan? Pengaturan firewall default CentOS melarang koneksi masuk ke port http. Lakukan hal berikut untuk membukanya.
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
Refresh halaman di browser Anda ( F5) dan Anda akan mendapatkan halaman info PHP standar.
http://example.com,, http://www.example.comdan https://example.comke https://www.example.com(Dynamic Page, PHP-FPM 7.1.x) KonfigurasiArahkan ke /etc/h2o/direktori.
cd /etc/h2o/
Ganti nama default h2o.confmenjadi h2o.conf.original.
sudo mv h2o.conf h2o.conf.original
Buat h2o.conffile baru .
sudo nano h2o.conf
Salin dan tempel teks di bawah ini ke dalam h2o.conffile.
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
Buat direktori khusus untuk menyimpan opsi SSL default untuk semua situs web yang menggunakan SSL.
sudo mkdir conf.d
Buat ssl.conffile baru .
sudo nano conf.d/ssl.conf
Salin dan tempel teks di bawah ini ke dalam ssl.conffile.
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
Buat direktori untuk menyimpan dhparam_2048.pemfile yang akan dibuat ulang setiap hari melalui cronjob.
sudo mkdir /etc/ssl/h2o/
Buat regenerate_dhparamfile baru .
sudo nano /etc/cron.daily/regenerate_dhparam
Salin dan tempel teks berikut di dalam regenerate_dhparamfile.
#!/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
Buat file bash yang baru saja dibuat dapat dieksekusi.
sudo chmod +x /etc/cron.daily/regenerate_dhparam
Jalankan skrip bash untuk menjalankan pertama karena H2O tidak akan mulai dengan benar jika tidak dibuat. Ini akan memakan waktu sekitar satu atau dua menit untuk menghasilkan pada menjalankan pertama.
sudo /etc/cron.daily/regenerate_dhparam
Untuk memproses PHP, daemon PHP-FPM 7.1 harus diinstal dan dikonfigurasi. Untuk menginstal versi PHP-FPM yang lebih baru dari versi 5.4.x default, repo REMI harus diinstal yang berisi versi PHP 5.6.x, 7.0.x dan 7.1.x. Ketik perintah berikut untuk menginstal PHP versi 7.1.x.
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
sudo yum install php71-php-fpm -y
Arahkan ke /etc/opt/remi/php71/direktori.
cd /etc/opt/remi/php71/
Ganti nama default php-fpm.confmenjadi php-fpm.conf.original.
sudo mv php-fpm.conf php-fpm.conf.original
Buat php-fpm.conffile baru .
sudo nano php-fpm.conf
Salin dan tempel teks berikut ke dalam php-fpm.conffile.
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
Ganti nama www.conffile default di php-fpm.ddirektori.
sudo mv php-fpm.d/www.conf php-fpm.d/www.conf.original
Buat www.conffile baru .
sudo nano php-fpm.d/www.conf
Salin dan tempel teks di bawah ini ke dalam www.conffile. Ubah Anda pm.max\_childrenuntuk mencocokkan jumlah CPU sesuai dengan instance VPS Anda.
[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
Ganti nama php.inifile default .
sudo mv php.ini php.ini.original
Buat php.inifile baru .
sudo nano php.ini
Salin dan tempel teks berikut di bawah ini ke yang baru php.ini file. Mengubah memory\_limit, post\_max\_size, upload\_max\_filesizedan date.timezonesesuai dengan contoh VPS Anda.
[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"
Ubah kepemilikan grup untuk /var/opt/remi/php71/lib/php/session/direktori dari apachegrup ke h2ogrup.
sudo chown root.h2o /var/opt/remi/php71/lib/php/session/
Buat direktori tempat log server PHP-FPM akan berada.
sudo mkdir /var/log/php-fpm/
Aktifkan dan mulai server PHP-FPM.
sudo systemctl enable php71-php-fpm
sudo systemctl start php71-php-fpm
Aktifkan dan mulai server H2O.
sudo systemctl enable h2o
sudo systemctl start h2o
Buat direktori di mana default index.phpakan berada terdaftar oleh opsi direktori file.dirdi atas /var/www/example.com.
sudo mkdir /var/www/www.example.com
Buat default index.phpmenggunakan phpinfoperintah untuk menguji PHP.
sudo nano /var/www/www.example.com/index.php
Salin dan tempel teks di bawah ini di index.phpfile baru .
<?php
phpinfo();
?>
Sekarang, buka browser Anda dan masukkan nama domain server ( example.comatau www.example.com) untuk instance Anda. Apakah Anda mendapatkan Unable to connectatau This site can’t be reachedpesan? Pengaturan firewall default CentOS melarang koneksi masuk ke port http. Lakukan hal berikut untuk membukanya.
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
Refresh halaman di browser Anda ( F5) dan Anda akan mendapatkan halaman info PHP standar.
Ini mengakhiri tutorial saya. Terima kasih sudah membaca.
Pelajari langkah-langkah untuk memasang Panel Kontrol Hosting Mudah (EHCP) di Ubuntu 16.04 dengan panduan ini.
Wawasan tentang 26 Teknik Analisis Data Besar: Bagian 1
Baca blog untuk mengetahui berbagai lapisan dalam Arsitektur Big Data dan fungsinya dengan cara yang paling sederhana.
Banyak dari Anda tahu Switch keluar pada Maret 2017 dan fitur-fitur barunya. Bagi yang belum tahu, kami sudah menyiapkan daftar fitur yang membuat 'Switch' menjadi 'gadget yang wajib dimiliki'.
Apakah Anda menunggu raksasa teknologi untuk memenuhi janji mereka? periksa apa yang belum terkirim.
Baca ini untuk mengetahui bagaimana Kecerdasan Buatan menjadi populer di antara perusahaan skala kecil dan bagaimana hal itu meningkatkan kemungkinan untuk membuat mereka tumbuh dan memberi keunggulan pada pesaing mereka.
Saat Sains Berkembang dengan kecepatan tinggi, mengambil alih banyak upaya kita, risiko menundukkan diri kita pada Singularitas yang tidak dapat dijelaskan juga meningkat. Baca, apa arti singularitas bagi kita.
CAPTCHA telah berkembang cukup sulit bagi pengguna untuk dipecahkan dalam beberapa tahun terakhir. Apakah itu akan tetap efektif dalam deteksi spam dan bot di masa mendatang?
Apa itu telemedicine, perawatan kesehatan jarak jauh dan dampaknya terhadap generasi mendatang? Apakah itu tempat yang bagus atau tidak dalam situasi pandemi? Baca blog untuk menemukan tampilan!
Anda mungkin pernah mendengar bahwa peretas menghasilkan banyak uang, tetapi pernahkah Anda bertanya-tanya bagaimana cara mereka mendapatkan uang sebanyak itu? mari berdiskusi.