質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Laravel

LaravelとはTaylor Otwellによって開発された、オープンソースなPHPフレームワークです。Laravelはシンプルで表現的なシンタックスを持ち合わせており、ウェブアプリケーション開発の手助けをしてくれます。

Apache

Apacheは、Apache HTTP Serverの略で、最も人気の高いWebサーバソフトウェアの一つです。安定性が高いオープンソースソフトウェアとして商用サイトから自宅サーバまで、多くのプラットフォーム向けに開発・配布されています。サーバーソフトウェアの不具合(NCSA httpd)を修正するパッチ(a patch)を集積、一つ独立したソフトウェアとして開発されました。

nginx

nginixは軽量で高性能なwebサーバーの1つです。BSD-likeライセンスのもとリリースされており、あわせてHTTPサーバ、リバースプロキシ、メールプロキシの機能も備えています。MacOSX、Windows、Linux、上で動作します。

Q&A

解決済

2回答

1445閲覧

[Laravel/nginx/apache] VPSサーバーでマルチドメイン設定をしている片方のドメインが表示されない

saori777

総合スコア6

Laravel

LaravelとはTaylor Otwellによって開発された、オープンソースなPHPフレームワークです。Laravelはシンプルで表現的なシンタックスを持ち合わせており、ウェブアプリケーション開発の手助けをしてくれます。

Apache

Apacheは、Apache HTTP Serverの略で、最も人気の高いWebサーバソフトウェアの一つです。安定性が高いオープンソースソフトウェアとして商用サイトから自宅サーバまで、多くのプラットフォーム向けに開発・配布されています。サーバーソフトウェアの不具合(NCSA httpd)を修正するパッチ(a patch)を集積、一つ独立したソフトウェアとして開発されました。

nginx

nginixは軽量で高性能なwebサーバーの1つです。BSD-likeライセンスのもとリリースされており、あわせてHTTPサーバ、リバースプロキシ、メールプロキシの機能も備えています。MacOSX、Windows、Linux、上で動作します。

0グッド

0クリップ

投稿2021/06/14 16:07

編集2021/06/14 23:24

実現したいこと

app2を表示させたいです。
※ app1は表示されます。

現状出ているエラー

マルチドメイン設定を行っている片方のドメインがうまく表示されません。
nginxなどのルーティング設定が怪しいと考え、nginx -tコマンドを実行したところ、エラーが出てしまいました。

$ nginx -t nginx: [emerg] unexpected end of file, expecting ";" or "}" in /etc/letsencrypt/options-ssl-apache.conf:9 nginx: configuration file /etc/nginx/nginx.conf test faile $ vi /etc/letsencrypt/options-ssl-apache.conf SSLEngine on SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1 SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384 SSLHonorCipherOrder off SSLSessionTickets off SSLOptions +StrictRequire

試したこと

1.リブート
2./var/www/html/nuriemon/public/index.html に「OK」と記載したファイルを追加

問題なく表示されました。

3.全てに;を追加した

※ 以下のエラーに変わった

nginx: [emerg] unknown directive "SSLEngine" in /etc/letsencrypt/options-ssl-apache.conf:7 nginx: configuration file /etc/nginx/nginx.conf test failed

その他情報

$ /usr/lib/systemd/system/httpd.service [Unit] Description=The Apache HTTP Server Wants=httpd-init.service After=network.target remote-fs.target nss-lookup.target httpd-init.service Documentation=man:httpd.service(8) [Service] Type=notify Environment=LANG=C ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND ExecReload=/usr/sbin/httpd $OPTIONS -k graceful # Send SIGWINCH for graceful stop KillSignal=SIGWINCH KillMode=mixed PrivateTmp=true [Install] WantedBy=multi-user.target
$ vi /etc/nginx/nginx.conf user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /run/nginx.pid; # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. include /usr/share/nginx/modules/*.conf; events { worker_connections 1024; } http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; # Load modular configuration files from the /etc/nginx/conf.d directory. # See http://nginx.org/en/docs/ngx_core_module.html#include # for more information. include /etc/nginx/conf.d/*.conf; server { listen 80 default_server; listen [::]:80 default_server; server_name _; root /usr/share/nginx/html; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } }
$ vi /etc/nginx/default.d/php.conf index index.php index.html index.htm; location ~ .php$ { try_files $uri =404; fastcgi_intercept_errors on; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass php-fpm; }
$ vi /etc/httpd/conf/httpd.conf ※ コメントアウトの箇所は記載しておりません。 ServerRoot "/etc/httpd" Listen 80 <VirtualHost *:80> #ServerAdmin root@app1.com DocumentRoot /var/www/html/ZOTMAN/public ServerName app1.com #RewriteEngine on #RewriteCond %{SERVER_NAME} =app1.com #RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] RewriteEngine on RewriteCond %{SERVER_NAME} =app1.com RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] </VirtualHost> <VirtualHost *:80> #ServerAdmin root@app2.com DocumentRoot /var/www/html/app2/public ServerName app2.com #RewriteEngine on #RewriteCond %{SERVER_NAME} =app1.com #RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] RewriteEngine on RewriteCond %{SERVER_NAME} =app2.com RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] </VirtualHost> Include conf.modules.d/*.conf User apache Group apache ServerAdmin root@app1.com ServerName app1.com <Directory /> AllowOverride All Require all denied </Directory> DocumentRoot "/var/www/html" <Directory "/var/www"> AllowOverride All # Allow open access: Require all granted </Directory> <Directory "/var/www/html"> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> <IfModule dir_module> DirectoryIndex index.html </IfModule> <Files ".ht*"> Require all denied </Files> ErrorLog "logs/error_log" LogLevel warn <IfModule log_config_module> LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %b" common <IfModule logio_module> LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio </IfModule> CustomLog "logs/access_log" combined </IfModule> <IfModule alias_module> ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" </IfModule> <Directory "/var/www/cgi-bin"> AllowOverride None Options None Require all granted </Directory> <IfModule mime_module> TypesConfig /etc/mime.types AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddType text/html .shtml AddOutputFilter INCLUDES .shtml </IfModule> AddDefaultCharset UTF-8 <IfModule mime_magic_module> MIMEMagicFile conf/magic </IfModule> EnableSendfile on IncludeOptional conf.d/*.conf Include /etc/httpd/conf/httpd-le-ssl.conf ~

お力添えいただけると幸いです。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

AbeTakashi

2021/06/14 16:59

nginx.confの内容もApacheの設定内容も書かれていないのに、これで正しい回答出せる人がいたらエスパーだと思います。あと、nginxとApacheの二つをどう使っているのかもよく分からないです。nginxはリバースプロキシとして使い、Apacheをhttpサーバとして使ってるとかでしょうか? その辺も含めてもう少し必要な情報を質問文に追記していただければ、答えられる人が出てくると思います。
saori777

2021/06/14 23:11

大変失礼しました、いずれも記載してみます。
guest

回答2

0

ベストアンサー

yukkyさんが書いてることと同じになりますが、nginxの設定とApacheの設定がごっちゃになっているようです。おそらくやりたいことはnginxだけで実現できるので、Apacheを別に使わなければならない理由がないようにも見えます。Apacheの要素を排除して、SSLの設定も含めてすべてnginxの設定に置き換えれば動くようになると思われます。

参考
https://qiita.com/taptappun/items/5a87eda053d7181430c9

nginx virtualhost sslでググれば色々出てくると思うので、チャレンジしてみてください。

投稿2021/06/15 01:07

AbeTakashi

総合スコア4537

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

saori777

2021/06/22 01:08

ご丁寧に有難うございます。 Apacheを使わずに実装してみます。
guest

0

nginx に apache の設定ファイルを読み込ませてしまっています

投稿2021/06/14 17:48

yukky1201

総合スコア2751

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

saori777

2021/06/22 01:09

ご丁寧に有難うございます。 そのようですね、、、 ご指摘有難うございました
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問