docker初心者です。
81番ポートでapacheコンテナを動かそうとしているのですが、http://xxx.xxx.xxx:81
でアクセスすると、以下の内容のファイルがダウンロードされてしまいます。
(Laravelのオートローダーのようです。)
<?php /** * Laravel - A PHP Framework For Web Artisans * * @package Laravel * @author Taylor Otwell <taylor@laravel.com> */ define('LARAVEL_START', microtime(true)); /* |-------------------------------------------------------------------------- | Register The Auto Loader |-------------------------------------------------------------------------- | | Composer provides a convenient, automatically generated class loader for | our application. We just need to utilize it! We'll simply require it | into the script here so that we don't have to worry about manual | loading any of our classes later on. It feels great to relax. | */ require __DIR__.'/../vendor/autoload.php'; /* |-------------------------------------------------------------------------- | Turn On The Lights |-------------------------------------------------------------------------- | | We need to illuminate PHP development, so let us turn on the lights. | This bootstraps the framework and gets it ready for use, then it | will load up this application so that we can run it and send | the responses back to the browser and delight our users. | */ $app = require_once __DIR__.'/../bootstrap/app.php'; /* |-------------------------------------------------------------------------- | Run The Application |-------------------------------------------------------------------------- | | Once we have the application, we can handle the incoming request | through the kernel, and send the associated response back to | the client's browser allowing them to enjoy the creative | and wonderful application we have prepared for them. | */ $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); $response = $kernel->handle( $request = Illuminate\Http\Request::capture() ); $response->send(); $kernel->terminate($request, $response);
docker ps
の結果は以下です。
[root@os3-374-20202 httpd]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES bb54e119662c 75d6aabd27d6 "/sbin/init" 29 minutes ago Up 29 minutes 80/tcp, 0.0.0.0:81->81/tcp ga_k8s-test1 b5b9a182ca27 laradock_beanstalkd "/usr/bin/beanstalkd" 3 hours ago Up 3 hours 0.0.0.0:11300->11300/tcp laradock_beanstalkd_1 54de35884935 laradock_nginx "/bin/bash /opt/star…" 3 hours ago Up 3 hours 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp laradock_nginx_1 fce505b944c5 laradock_php-fpm "docker-php-entrypoi…" 3 hours ago Up 3 hours 9000/tcp laradock_php-fpm_1 cc2c20deff49 laradock_workspace "/sbin/my_init" 3 hours ago Up 3 hours 0.0.0.0:2222->22/tcp laradock_workspace_1 5bb8870c05d4 laradock_mysql "docker-entrypoint.s…" 3 hours ago Up 3 hours 0.0.0.0:3306->3306/tcp, 33060/tcp laradock_mysql_1 23968ee56bc4 docker:dind "dockerd-entrypoint.…" 3 hours ago Up 3 hours 2375/tcp laradock_docker-in-docker_1 ef4e1aa9c143 laradock_redis "docker-entrypoint.s…" 3 hours ago Up 3 hours 0.0.0.0:6379->6379/tcp laradock_redis_1 ※一番上の ga_k8s-test1 が問題のコンテナです。
ga-k8s-test1
の中の /etc/httpd/conf.d/php.conf
の記述が以下です。
[root@bb54e119662c conf.d]# cat php.conf # # The following lines prevent .user.ini files from being viewed by Web clients. # <Files ".user.ini"> <IfModule mod_authz_core.c> Require all denied </IfModule> <IfModule !mod_authz_core.c> Order allow,deny Deny from all Satisfy All </IfModule> </Files> # # Allow php to handle Multiviews # AddType text/html .php # # Add index.php to the list of files that will be served as directory # indexes. # DirectoryIndex index.php # mod_php options <IfModule mod_php7.c> # # Cause the PHP interpreter to handle files with a .php extension. # <FilesMatch .(php|phar)$> SetHandler application/x-httpd-php </FilesMatch> # # Uncomment the following lines to allow PHP to pretty-print .phps # files as PHP source code: # #<FilesMatch .phps$> # SetHandler application/x-httpd-php-source #</FilesMatch> # # Apache specific PHP configuration options # those can be override in each configured vhost # php_value session.save_handler "files" php_value session.save_path "/var/lib/php/session" php_value soap.wsdl_cache_dir "/var/lib/php/wsdlcache" #php_value opcache.file_cache "/var/lib/php/opcache" </IfModule>
ホスト側でもコンテナ側でも、curl http://localhost:81
を実行するとちゃんとhtmlファイルが返ってきます。
どうしてブラウザから http://xxx.xxx.xxx:81 (xxx.xxx.xxxはドメイン名)
を叩くと、ファイルのダウンロードになってしまうのでしょうか。
追記
なぜか edge からだと正常にアクセスできました。
chromeだと上記の事象になります。
chromeに何か原因があるんでしょうか?

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/01/09 11:52 編集