初期セットアップが完了した、webvirtmgr を /var/www/ 配下へ移動する。
$ sudo mv webvirtmgr /var/www/
$ sudo ls /var/www/
webvirtmgr
$
/var/www ディレクトリに所有権/グループをnginxに変更する。
$ sudo chown -R nginx:nginx /var/www/webvirtmgr
/etc/nginx/conf.d/ 配下に webvirtmgr ファイルを新規作成し、以下設定を登録する。
$ sudo vim /etc/nginx/conf.d/webvirtmgr.conf
server {
listen 80 default_server;
server_name $hostname;
#access_log /var/log/nginx/webvirtmgr_access_log;
location /static/ {
root /var/www/webvirtmgr/webvirtmgr;
expires max;
}
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 600;
proxy_read_timeout 600;
proxy_send_timeout 600;
client_max_body_size 1024M;
}
}
Webサーバー(nginx)を再起動する。
$ sudo systemctl restart nginx
$
$ sudo systemctl status nginx
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: active (running) since 日 2018-10-07 01:24:44 JST; 6s ago
Process: 10393 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
Process: 10390 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 10384 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Main PID: 10394 (nginx)
Tasks: 13
CGroup: /system.slice/nginx.service
├─10394 nginx: master process /usr/sbin/nginx
├─10395 nginx: worker process
├─10396 nginx: worker process
├─10397 nginx: worker process
├─10398 nginx: worker process
├─10399 nginx: worker process
├─10400 nginx: worker process
├─10401 nginx: worker process
├─10402 nginx: worker process
├─10403 nginx: worker process
├─10405 nginx: worker process
├─10408 nginx: worker process
└─10409 nginx: worker process
10月 07 01:24:44 localhost.localdomain systemd[1]: Starting The nginx HTTP a...
10月 07 01:24:44 localhost.localdomain nginx[10390]: nginx: the configuratio...
10月 07 01:24:44 localhost.localdomain nginx[10390]: nginx: configuration fi...
10月 07 01:24:44 localhost.localdomain systemd[1]: Started The nginx HTTP an...
Hint: Some lines were ellipsized, use -l to show in full.
$
httpdのプロセスが外部にアクセス可能とする SELinux設定を追加する。
$ sudo /usr/sbin/setsebool httpd_can_network_connect true