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

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

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

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

PHP

PHPは、Webサイト構築に特化して開発されたプログラミング言語です。大きな特徴のひとつは、HTMLに直接プログラムを埋め込むことができるという点です。PHPを用いることで、HTMLを動的コンテンツとして出力できます。HTMLがそのままブラウザに表示されるのに対し、PHPプログラムはサーバ側で実行された結果がブラウザに表示されるため、PHPスクリプトは「サーバサイドスクリプト」と呼ばれています。

MAMP

Mac 上で WordPress などの動的ページのサイトが作れるように環境を構築するフリーソフト

Q&A

解決済

2回答

864閲覧

MAMPでWebサーバーをApacheからNginxに切り替えて動かしたいがエラーが出て解決できない

takomin

総合スコア9

nginx

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

PHP

PHPは、Webサイト構築に特化して開発されたプログラミング言語です。大きな特徴のひとつは、HTMLに直接プログラムを埋め込むことができるという点です。PHPを用いることで、HTMLを動的コンテンツとして出力できます。HTMLがそのままブラウザに表示されるのに対し、PHPプログラムはサーバ側で実行された結果がブラウザに表示されるため、PHPスクリプトは「サーバサイドスクリプト」と呼ばれています。

MAMP

Mac 上で WordPress などの動的ページのサイトが作れるように環境を構築するフリーソフト

0グッド

0クリップ

投稿2018/07/19 03:21

前提・実現したいこと

MAMPのWebサーバーをApacheからNginxに変更しようとしています。
nginx.confを設定後、サーバを起動してlocalhostにアクセスしようとしたら、chromeに下記のメッセージが出ます。

発生している問題・エラーメッセージ

Sorry, the page you are looking for could not be found. 1/1 NotFoundHttpException in RouteCollection.php line 161: in RouteCollection.php line 161 at RouteCollection->match(object(Request)) in Router.php line 821 at Router->findRoute(object(Request)) in Router.php line 691 at Router->dispatchToRoute(object(Request)) in Router.php line 675 at Router->dispatch(object(Request)) in Kernel.php line 246 at Kernel->Illuminate\Foundation\Http\{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52 at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44 at CheckForMaintenanceMode->handle(object(Request), object(Closure)) at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136 at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32 at Pipeline->Illuminate\Routing\{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 102 at Pipeline->then(object(Closure)) in Kernel.php line 132 at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99 at Kernel->handle(object(Request)) in index.php line 53

該当のソースコード

どこを修正すれば良いのかわからず困っています。
解決方法が分かる方がいたら教えてください。
以下はnginx.confの設定ファイルです。

mac os 10.12.6 Sierra php7.21 MAMP Version 4.5 (3208)になります。
Apacheは成功というメッセージが出てきます。
上司はPHPのバージョンが高すぎるのではないかということでバージョンダウンを試みましたが
うまく行きません。

#load_module "modules/ngx_http_image_filter_module.so"; #load_module "modules/ngx_http_perl_module.so"; #load_module "modules/ngx_http_xslt_filter_module.so"; #load_module "modules/ngx_mail_module.so"; #load_module "modules/ngx_stream_module.so"; user root admin; worker_processes 2; events { worker_connections 1024; } http { include mime.types; include /Applications/MAMP/conf/nginx/conf.d/engineer_route.conf; default_type text/html; gzip on; gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon; client_max_body_size 3M; sendfile on; server { listen 80 default_server; # MAMP DOCUMENT_ROOT !! Don't remove this line !! root "/Applications/MAMP/htdocs"; access_log /Applications/MAMP/logs/nginx_access.log; error_log /Applications/MAMP/logs/nginx_error.log; location / { index index.html index.php; } location ~* /MAMP[^-]*(.*)$ { root /Applications/MAMP/bin; index index.php; location ~ .php$ { try_files $uri =404; fastcgi_pass unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } location ~* /phpMyAdmin(.*)$ { root /Applications/MAMP/bin; index index.php; location ~ .php$ { try_files $uri =404; fastcgi_pass unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } location ~* /phpPgAdmin(.*)$ { root /Applications/MAMP/bin; index index.php; location ~ .php$ { try_files $uri =404; fastcgi_pass unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } location ~* /phpLiteAdmin(.*)$ { root /Applications/MAMP/bin; index index.php; location ~ .php$ { try_files $uri =404; fastcgi_pass unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } location ~* /adminer(.*)$ { root /Applications/MAMP/bin; index adminer.php; location ~ .php$ { try_files $uri =404; fastcgi_pass unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } location /icons { alias /Applications/MAMP/Library/icons; autoindex on; } location /favicon.ico { alias /Applications/MAMP/bin/favicon.ico; # log_not_found off; # access_log off; } location ~ .php$ { try_files $uri =404; fastcgi_pass unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ /. { deny all; } # location ~* .(gif|jpg|png|pdf)$ { # expires 30d; # } # location = /robots.txt { # allow all; # log_not_found off; # access_log off; # } # location ~* .(txt|log)$ { # allow 127.0.0.1; # deny all; # } # location ~ ..*/.*.php$ { # return 403; # } location /nginx_status { stub_status on; access_log off; allow 127.0.0.1; deny all; } } # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }

試したこと

ここに問題に対して試したことを記載してください。
PHPのバージョンを下げる
https://qiita.com/nobumaka/items/f19e259ed890d914dfbe
MAMPのキャッシュを削除などです。
よろしくお願いいたします。

補足情報(FW/ツールのバージョンなど)

ここにより詳細な情報を記載してください。

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

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

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

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

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

ryochin

2018/07/19 04:59

NotFoundHttpException とあるので何かのファイルが見つからないのでしょう。nginx のエラーログがあれば提示願います。
takomin

2019/03/28 02:20

ご連絡が遅くなり、申しわけございません。ありがとうございました。
guest

回答2

0

解決できませんでしたが質問を消したいため投稿します。

投稿2019/03/29 00:51

takomin

総合スコア9

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

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

0

自己解決

うまくいかなかったのですが、ひとまず解決とさせてください。

投稿2019/03/28 03:18

takomin

総合スコア9

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問