ユーザ用ツール

サイト用ツール


linux:nginx

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
linux:nginx [2023/04/11 13:18] mikotolinux:nginx [2025/02/20 15:37] (現在) mikoto
行 1: 行 1:
 ====== NginxによるWebサーバー構築 ====== ====== NginxによるWebサーバー構築 ======
 +[[:linux|Linux]]
 +
 +===== インストール =====
 +まずはdnfモジュールを検索する。
 +<code bash>
 +dnf module list nginx
 +</code>
 +
 +dnfモジュールをインストールする。
 +<code bash>
 +dnf module install nginx:1.20
 +</code>
 +
 ===== リバースプロキシ設定 ===== ===== リバースプロキシ設定 =====
 +
 +リバースプロキシを設定するには、
 +/etc/nginx/conf.d/springboot.conf を編集する。
 +<code>
 +server {
 +  listen 443 ssl;
 +  server_name host.example.com; #ホスト名を指定
 +
 +  ssl_certificate /etc/pki/nginx/server.crt; # 証明書のパスを指定
 +  ssl_certificate_key /etc/pki/nginx/private/server.key; # 証明書の秘密鍵のパスを指定
 +
 +  ssl_protocols TLSv1.2 TLSv1.3;
 +  ssl_ciphers HIGH:!aNULL:!MD5;
 +  ssl_prefer_server_ciphers on;
 +
 +  location / {
 +        #proxy_set_header X-Forwarded-Proto $scheme;
 +        #proxy_set_header Host   $http_host;
 +        #proxy_set_header Host   $host;
 +        #proxy_set_header X-Real-IP  $remote_addr;
 +        proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
 +    proxy_pass http://localhost:8080/;
 +  }
 +}
 +</code>
 +
 ===== SSL化設定 ====== ===== SSL化設定 ======
 ''/etc/pki/nginx''ディレクトリ内に証明書、''/etc/pki/nginx/private''ディレクトリ内に秘密鍵を入れる。 ''/etc/pki/nginx''ディレクトリ内に証明書、''/etc/pki/nginx/private''ディレクトリ内に秘密鍵を入れる。
行 9: 行 48:
    server_name localhost;    server_name localhost;
  
-   ssl_certificate /etc/pki/nginx/api-acs-murauchi-com.crt+   ssl_certificate /etc/pki/nginx/<crt_file>
-   ssl_certificate_key /etc/pki/nginx/private/api-acs-murauchi-com.key;+   ssl_certificate_key /etc/pki/nginx/private/<key_file>;
  
    ssl_protocols TLSv1.2 TLSv1.3;    ssl_protocols TLSv1.2 TLSv1.3;
linux/nginx.1681186692.txt.gz · 最終更新: 2023/04/11 13:18 by mikoto