前提・実現したいこと
1つのLinux(RHEL7)上でsquidを使用したプロキシを複数立てたいと考えています。
条件としては、
・IPは同一
・ポート番号のみ分ける
・受信ポートで異なる設定ファイルを読み込む
(受信ポート8080の場合:squid.conf、受信ポート8081の場合:squid8081.conf)
・ログファイル、キャッシュは別の場所に保存したい⇒ここでトラブル発生
(※キャッシュの記述に関しては、問題の切り分けのためコメントアウトしています)
発生している問題・エラーメッセージ
squid.serviceとsquid8081.serviceを起動することはできるのですが、access_logの場所を指定すると、squid8081が起動できません。ログの指定や設定が間違えていることはわかるのですが、どう直すことが正解なのかわかりません。
squid8081.service(#systemctl status squid8081)
● squid8081.service - Squid caching proxy Loaded: loaded (/etc/systemd/system/multi-user.target.wants/squid8081.service; bad; vendor preset: disabled) Active: failed (Result: exit-code) since Fri 2020-03-13 01:52:28 UTC; 2min 21s ago Process: 2568 ExecStop=/usr/sbin/squid -k shutdown -f $SQUID_CONF (code=exited, status=1/FAILURE) Process: 2516 ExecStart=/usr/sbin/squid $SQUID_OPTS -f $SQUID_CONF (code=exited, status=0/SUCCESS) Process: 2510 ExecStartPre=/usr/libexec/squid/cache_swap8081.sh (code=exited, status=0/SUCCESS) Main PID: 2518 (code=exited, status=1/FAILURE) Mar 13 01:52:27 vm-testproxy squid[2518]: Squid Parent: (squid-1) process 2563 started Mar 13 01:52:28 vm-testproxy (squid-1)[2563]: I don't handle this error well! Mar 13 01:52:28 vm-testproxy squid[2518]: Squid Parent: (squid-1) process 2563 exited with status 1 Mar 13 01:52:28 vm-testproxy squid[2518]: Squid Parent: (squid-1) process 2563 will not be restarted due to repeated, frequent failures Mar 13 01:52:28 vm-testproxy squid[2518]: Exiting due to repeated, frequent failures Mar 13 01:52:28 vm-testproxy systemd[1]: squid8081.service: main process exited, code=exited, status=1/FAILURE Mar 13 01:52:28 vm-testproxy squid[2568]: squid: ERROR: Could not send signal 15 to process 2563: (3) No such process Mar 13 01:52:28 vm-testproxy systemd[1]: squid8081.service: control process exited, code=exited status=1 Mar 13 01:52:28 vm-testproxy systemd[1]: Unit squid8081.service entered failed state. Mar 13 01:52:28 vm-testproxy systemd[1]: squid8081.service failed.
該当のソースコード
squid8081.conf
# # Recommended minimum configuration: # # Example rule allowing access from your local networks. # Adapt to list your (internal) IP networks from where browsing # should be allowed acl localnet src 10.0.0.0/8 # RFC1918 possible internal network acl localnet src 172.16.0.0/12 # RFC1918 possible internal network acl localnet src 192.168.0.0/16 # RFC1918 possible internal network acl localnet src fc00::/7# RFC 4193 local private network range acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines acl SSL_ports port 443 acl Safe_ports port 80# http acl Safe_ports port 21# ftp acl Safe_ports port 443# https acl Safe_ports port 70# gopher acl Safe_ports port 210# wais acl Safe_ports port 1025-65535 # unregistered ports acl Safe_ports port 280# http-mgmt acl Safe_ports port 488# gss-http acl Safe_ports port 591# filemaker acl Safe_ports port 777# multiling http acl CONNECT method CONNECT # # Recommended minimum Access Permission configuration: # # Deny requests to certain unsafe ports http_access deny !Safe_ports # Deny CONNECT to other than secure SSL ports http_access deny CONNECT !SSL_ports # Only allow cachemgr access from localhost http_access allow localhost manager http_access deny manager # We strongly recommend the following be uncommented to protect innocent # web applications running on the proxy server who think the only # one who can access services on "localhost" is a local user #http_access deny to_localhost # # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS # # Example rule allowing access from your local networks. # Adapt localnet in the ACL section to list your (internal) IP networks # from where browsing should be allowed http_access allow localnet http_access allow localhost # And finally deny all other access to this proxy http_access deny all # Squid normally listens to port 3128 http_port 8081 # Uncomment and adjust the following to add a disk cache directory. #cache_dir ufs /var/spool/squid 100 16 256 # Leave coredumps in the first cache dir coredump_dir /var/spool/squid access_log daemon:/var/log/squid8081/access.log # # Add any of your own refresh_pattern entries above these. # refresh_pattern ^ftp:1440 20% 10080 refresh_pattern ^gopher:1440 0% 1440 refresh_pattern -i (/cgi-bin/|?) 0 0% 0 refresh_pattern .020% 4320
ログファイルの権限情報
drwxrwxr-x. 2 root root 6 Mar 11 06:28 squid8081
試したこと
1./etc/squidディレクトリにsquid.conf(受信ポート8080)、squid8081.conf(受信ポート8081)の2つの設定ファイルを作成
2./var/log/squidをディレクトリごと/var/log/squid8081という名称でコピー
3./etc/sysconfig/squidをsquid8081という名前でコピーした後、中身を編集
4.etc/systemd/system/multi-user.target.wantsのsquid.serviceをsquid8081.serviceという名称でコピーした後、中身を編集(該当のソースコードに記載)
5.systemctlコマンドでデーモンをリロードし、squid.serviceとsquid8081.serviceを起動
アクセスログの記述をコメントアウトすれば問題なく起動するので、アクセスログ周りが問題だと思います。
補足情報(FW/ツールのバージョンなど)
環境:Azure
OS:RHEL7.7
squidのバージョン:3.5

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/03/16 02:32