個人的メモ
EPELリポジトリの追加
sudo rpm -ivh https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
sudo yum -y update epel-release
Remiリポジトリの追加
sudo rpm –import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
sudo rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
sudo yum -y update remi-release
sudo rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
sudo yum -y update nginx-release-centos
sudo yum -y –enablerepo=nginx install nginx
nginx -v
systemctl enable nginx
systemctl start nginx
firewall-cmd –add-service=http –zone=public –permanent
firewall-cmd –add-service=https –zone=public –permanent
firewall-cmd –reload
sudo groupadd -g 2222 hoge
sudo useradd -u 2222 -g hoge hoge
sudo usermod -s /bin/false hoge
sudo passwd hoge
パスの入力
PHP7.3インストール
sudo yum -y –enablerepo=remi-php73,epel install php-fpm php-gd php-gmp php-mbstring php-mcrypt php-opcache php-pdo php-pear-MDB2-Driver-mysqli php-pecl-memcached php-pecl-msgpack php-xml
PHPの確認
php -v
vi /etc/php-fpm.d/www.conf
user = hoge
; RPM: Keep a group allowed to write in log dir.
group = hoge
・
# 37行目あたり
listen = /var/run/php-fpm/php-fpm.sock
・
・
・
# 48行目あたり
listen.owner = hoge
listen.group = hoge
listen.mode = 0660
にする
sudo vi /etc/nginx/nginx.conf
# 2行目あたり
user hoge;
sudo systemctl start php-fpm.service
sudo systemctl enable php-fpm.service
$ sudo vi /etc/nginx/conf.d # 30行目あたり
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
} /default.conf
https://qiita.com/ksugawara61/items/0fcf3f72cc905bb6d654
ここと99%一緒なので↑みる
ついでにSSLいれてでHTTPS化する
cat medicalfields.jp.crt alphassl_intermediate_ca.cer > medicalfields.jp.pem
PEM routines:PEM_read_bio:bad end line.
がでたら
medicalfields.jp.pemのファイルを開いて
間に改行を入れて
—–END CERTIFICATE—–
—–BEGIN CERTIFICATE—–
にする
sudo vi /etc/nginx/conf.d/default.conf
server {
listen 443 ssl;
server_name _;
ssl_certificate /etc/nginx/ssl/medicalfields.jp.pem;
ssl_certificate_key /etc/nginx/ssl/medicalfields.jp.key;
~HTTPをコピペ~
}
/etc/nginx/conf.d/default.conf
server {
listen 443 ssl;
server_name _;
ssl_certificate /etc/nginx/ssl/medicalfields.jp.pem;
ssl_certificate_key /etc/nginx/ssl/medicalfields.jp.key;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache’s document root
# concurs with nginx’s one
#
#location ~ /\.ht {
# deny all;
#}
}
server {
listen 80;
server_name _ ;
# ここの部分で判定!!
if ($http_x_forwarded_proto != https) {
return 301 https://$host$request_uri;
}
}
リダイレクトループ対策でIFいれる
ロードバランサー
ラウンドロビンのヘルスモニターはPINGで(HTTPだと何か動かない時があったりちょっと不安定だった)
vi /etc/sysconfig/network-scripts/ifcfg-lo:0
DEVICE=lo:0
IPADDR=157.7.94.188
NETMASK=255.255.255.255
ONBOOT=yes
service network restart
オブジェクトストレージをマウントした
https://support.conoha.jp/v/objectstoragemount/
mount -t svfs object_storage /mnt -o auth_url=https://identity.tyo1.conoha.io/v2.0,username=gncu7228652,password=パス,tenant=gnct7228652
再起動時にマウント
vi /etc/fstab
一番下に
object_storage /mnt svfs auth_url=https://identity.tyo1.conoha.io/v2.0,username=gncu7228652,password=password,tenant=gnct7228652,rw,_netdev 1
WindowsのソフトはCyberDuck
https://support.conoha.jp/v/objectstoragecyberduck/