- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
无论我尝试什么,当我访问我的 docker-machine IP 时,我都会收到 HTTP 错误代码 500。
我通过 Docker 工具箱运行 laradock(操作系统:Windows 10)并运行默认虚拟机。我已经按照视频中的说明设置了 laradock。
我已成功将所需的文件夹安装到虚拟机中,并根据虚拟机中代码的位置更改了 docker-compose.yml:
这是我的 docker-compose.yml 文件:
version: '2'
services:
Nginx Server Container
nginx:
build: ./nginx
volumes_from:
- volumes_source
volumes:
- ./logs/nginx/:/var/log/nginx
ports:
- "80:80"
- "443:443"
links:
- php-fpmPHP-FPM Container
php-fpm:
build:
context: ./php-fpm
dockerfile: Dockerfile-70
volumes_from:
- volumes_source
expose:
- "9000"
links:
- workspaceMySQL Container
mysql:
build: ./mysql
volumes_from:
- volumes_data
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: homestead
MYSQL_USER: homestead
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: rootPostgreSQL Container
postgres:
build: ./postgres
volumes_from:
- volumes_data
ports:
- "5432:5432"
environment:
POSTGRES_DB: homestead
POSTGRES_USER: homestead
POSTGRES_PASSWORD: secretMariaDB Container
mariadb:
build: ./mariadb
volumes_from:
- volumes_data
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: homestead
MYSQL_USER: homestead
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: rootNeo4j Container
neo4j:
build: ./neo4j
ports:
- "7474:7474"
- "1337:1337"
environment:
- NEO4J_AUTH=homestead:secret
volumes_from:
- volumes_dataMongoDB Container
mongo:
build: ./mongo
ports:
- "27017:27017"
volumes_from:
- volumes_dataRedis Container
redis:
build: ./redis
volumes_from:
- volumes_data
ports:
- "6379:6379"Memcached Container
memcached:
build: ./memcached
volumes_from:
- volumes_data
ports:
- "11211:11211"
links:
- php-fpmBeanstalkd Container
beanstalkd:
build: ./beanstalkd
ports:
- "11300:11300"
privileged: true
links:
- php-fpmBeanstalkd Console Container
beanstalkd-console:
build: ./beanstalkd-console
ports:
- "2080:2080"
links:
- beanstalkdWorkspace Utilities Container
workspace:
build:
context: ./workspace
args:
- INSTALL_PRESTISSIMO=false
volumes_from:
- volumes_source
tty: trueLaravel Application Code Container
volumes_source:
build: ./volumes/application
volumes:
- /c/Users/pomodoro.xyz/code:/var/www/laravelDatabases Data Container
volumes_data:
build: ./volumes/data
volumes:
- /var/lib/mysql:/var/lib/mysql
- /var/lib/postgres:/var/lib/postgres
- /var/lib/mariadb:/var/lib/mariadb
- /var/lib/memcached:/var/lib/memcached
- /var/lib/redis:/data
- /var/lib/neo4j:/var/lib/neo4j/data
- /var/lib/mongo:/data/dbAdd more Containers below
当我登录工作区并更改文件时,它们会反射(reflect)到主机中,因此我在这方面很擅长。
这是我的工作容器中的文件夹结构(正如视频所示):
root@d463d55e545b:/var/www/laravel# ls -l
total 30
drwxrwxrwx 1 1000 staff 4096 Jul 20 19:58 app
-rwxrwxrwx 1 1000 staff 1646 Jul 20 19:58 artisan
drwxrwxrwx 1 1000 staff 0 Jul 20 19:58 bootstrap
-rwxrwxrwx 1 1000 staff 1272 Jul 20 19:58 composer.json
drwxrwxrwx 1 1000 staff 4096 Jul 20 19:58 config
drwxrwxrwx 1 1000 staff 4096 Jul 20 19:58 database
-rwxrwxrwx 1 1000 staff 503 Jul 20 19:58 gulpfile.js
-rwxrwxrwx 1 1000 staff 12 Jul 21 15:13 index.html
drwxrwxrwx 1 1000 staff 4096 Jul 23 09:24 laradock
-rwxrwxrwx 1 1000 staff 212 Jul 20 19:58 package.json
-rwxrwxrwx 1 1000 staff 1026 Jul 20 19:58 phpunit.xml
drwxrwxrwx 1 1000 staff 4096 Jul 23 10:39 public
-rwxrwxrwx 1 1000 staff 1918 Jul 20 19:58 readme.md
drwxrwxrwx 1 1000 staff 0 Jul 20 19:58 resources
-rwxrwxrwx 1 1000 staff 567 Jul 20 19:58 server.php
drwxrwxrwx 1 1000 staff 0 Jul 20 19:58 storage
drwxrwxrwx 1 1000 staff 0 Jul 20 19:58 tests
drwxrwxrwx 1 1000 staff 0 Jul 20 19:59 vendor
所有 nginx.conf 文件等都被加载到容器中,正如我从 docker exec -it 看到的到我的 nginx 容器中一样。
作为引用,这是我的 laravel.conf
server { listen 80 default_server; listen [::]:80 default_server ipv6only=on;
root /var/www/laravel/public;
index index.php index.html index.htm;server_name laravel.dev www.laravel.dev;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass php-upstream;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}}
和 nginx.conf:
user www-data; worker_processes 4; pid /run/nginx.pid;
events { worker_connections 2048; multi_accept on; use epoll; }
http { server_tokens off; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 15; types_hash_max_size 2048; client_max_body_size 20M; include /etc/nginx/mime.types; default_type application/octet-stream; access_log on; error_log on; gzip on; gzip_disable "msie6"; include /etc/nginx/conf.d/.conf; include /etc/nginx/sites-available/; open_file_cache max=100; }
daemon off;
这是我的 laravel 根目录的 .env 文件:
APP_ENV=local APP_DEBUG=true APP_KEY=SomeRandomString APP_URL=http://localhost
DB_CONNECTION=mysql DB_HOST=192.168.99.100 DB_PORT=3306 DB_DATABASE=homestead DB_USERNAME=homestead DB_PASSWORD=secret
CACHE_DRIVER=file SESSION_DRIVER=file QUEUE_DRIVER=sync
REDIS_HOST=192.168.99.100 REDIS_PASSWORD=null REDIS_PORT=6379
MAIL_DRIVER=smtp MAIL_HOST=mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null
我还通过登录工作区容器并键入以下内容来设置文件夹的权限:
chmod -R 777 storage bootstrap/cache
但我仍然在 docker-machine ip 上收到 http 500 错误。我错过了什么?
最佳答案
我发现的一个潜在问题是您在 .env 中使用服务主机(DB_HOST、REDIS_HOST)的 IP 地址。这些 IP 地址可能会更改,因此使用容器名称作为主机地址更安全。在您的情况下,您需要使用“DB_HOST=mysql”和“REDIS_HOST=redis”。
http 500 意味着您的 nginx 配置可能没有任何问题,听起来更像是 Laravel 配置问题。我建议您检查 Laravel 日志文件 (storage/logs/laravel.log
) 以获取更多信息。
关于laravel - Laradock(docker)不断抛出http错误500,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38541831/
如果这不是一个错误,那就是另一个错误。如果不是那样的话,那就是别的东西了。我觉得我的项目已经改变了很多,现在只是试图解决代码签名问题,结果一切都搞砸了。我严格按照说明进行操作,但出现错误,例如当前的“
我不确定是否有一些我不知道的内置变量或规则,或者 make 是否有问题,或者我只是疯了。 对于我的一个项目,我有一个如下的 makefile: CC=g++ CFLAGS=-O3 `libpng-co
我有大约 10 个 div,它们必须不断翻转,每个 div 延迟 3 秒 这个 codrops 链接的最后一个效果是我正在寻找的,但无需单击 div http://tympanus.net/Devel
我如何使用 jQuery 持续运行 PHP 脚本并每秒获取响应,以及将鼠标上的少量数据发送到同一脚本? 我真的必须添加一些随机扩展才能让这么简单的计时器工作吗? 最佳答案 To iterate is
JBoss 4.x EJB 3.0 我见过如下代码(大大简化): @Stateless @TransactionAttribute(TransactionAttributeType.NOT_SUPPO
使用 PHPStorm,我试图忽略每次尝试进行 git 提交时 pop 的 workspace.xml。 我的 .gitignore 看起来像: /.idea/ .idea/workspace.xml
我是一名优秀的程序员,十分优秀!