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

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

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

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

nginx

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

サーバ

サーバは、 クライアントサーバモデルにおいてクライアントからの要求に対し 何らかのサービスを提供するプログラムを指す言葉です。 また、サーバーソフトウェアを稼動させているコンピュータ機器そのもののことも、 サーバーと呼ぶ場合もあります。

Q&A

解決済

1回答

3149閲覧

nginx ディレクトリへのアクセス禁止を解除したい。ディレクトリ内のファイルはアクセスできる。

earnest_gay

総合スコア615

Apache

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

nginx

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

サーバ

サーバは、 クライアントサーバモデルにおいてクライアントからの要求に対し 何らかのサービスを提供するプログラムを指す言葉です。 また、サーバーソフトウェアを稼動させているコンピュータ機器そのもののことも、 サーバーと呼ぶ場合もあります。

0グッド

0クリップ

投稿2018/02/07 12:56

MAMPに入ってるapacheからnginxに切り替えたところ、apacheでいうところのAllowOverrideの設定がなくなったのか存在するディレクトリにアクセスしてもディレクトリ表示はおろか403が帰ってくるようになりました。

apache
イメージ説明

nginx
イメージ説明

apacheはまったくわからないのですが、調べて色々試して見ましたが一向にダメです。

試したことは、

location /assets/ { deny all; }

こいつをコメントアウトして実行したぐらいですが、どうすればディレクトリのアクセス制限を解除できますでしょうか。

#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; 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; 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; # } #} }

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

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

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

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

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

guest

回答1

0

ベストアンサー

Location ではなく、Server 設定のどこかに

autoindex on;

を 追加で、どうでしょうか?

投稿2018/02/07 22:32

編集2018/02/07 22:37
CHERRY

総合スコア25171

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

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

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問