Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NGINX not start #164

Closed
roswitina opened this issue Oct 16, 2020 · 1 comment · Fixed by #159
Closed

NGINX not start #164

roswitina opened this issue Oct 16, 2020 · 1 comment · Fixed by #159
Labels
Bug Something isn't working
Milestone

Comments

@roswitina
Copy link

I use

docker-compose.production.yml

version: "3"

services:

--- MariaDB

db:
image: bitnami/mariadb:10.5
restart: unless-stopped
environment:
- MARIADB_ROOT_PASSWORD=${DB_PASSWORD}
- MARIADB_USER=${DB_USERNAME}
- MARIADB_PASSWORD=${DB_PASSWORD}
- MARIADB_DATABASE=${DB_DATABASE}
volumes:
- db:/bitnami

--- LinkAce Image with PHP 7.4

app:
image: linkace/linkace:latest
restart: unless-stopped
depends_on:
- db
volumes:
- linkace_app:/app
- ./.env:/app/.env
- ./logs:/app/storage/logs
# Remove the hash of the following line if you want to use local backups
#- ./backups:/app/storage/app/backups

--- nginx

nginx:
image: bitnami/nginx:1.19
restart: unless-stopped
ports:
- "0.0.0.0:80:8080"
#- "0.0.0.0:443:8443"
depends_on:
- app
volumes:
- linkace_app:/app
- ./nginx.conf:/opt/bitnami/nginx/conf/server_blocks/linkace.conf:ro
#- /path/to/your/ssl/certificates:/certs

--- Redis

redis:
image: bitnami/redis:6.0
restart: unless-stopped
environment:
- REDIS_PASSWORD=${REDIS_PASSWORD}

volumes:
linkace_app:
db:
driver: local

and nginx.conf

server {
root /app/public;
server_name _;
index index.php;
charset utf-8;
client_max_body_size 20M;
port_in_redirect off;

# Choose the connection method
listen 0.0.0.0:8080;
#listen 0.0.0.0:8443 ssl;

# Provide SSL certificates
#ssl_certificate      /certs/[FULLCHAIN FILE NAME];
#ssl_certificate_key  /certs/[CERTIFICATE KEY FILE NAME];

# Content security headers for Laravel
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";

# Gzip
gzip on;
gzip_vary on;
gzip_comp_level 8;
gzip_min_length 256;
gzip_proxied expired no-cache no-store private auth;
gzip_types application/javascript application/x-javascript application/xhtml+xml font/woff font/woff2 image/svg+xml image/x-icon text/css text/javascript text/plain text/xml;

# Location configs
location / {
    try_files $uri $uri/ /index.php?$query_string;
}

# CSS and Javascript
location ~* \.(?:css|js|map|scss)$ {
	expires 7d;
	access_log off;
	add_header Cache-Control "public";
	try_files $uri =404;
}

# Error pages
error_page 404 /index.php;
error_page 403 /index.php;

# PHP handling
location ~ \.php$ {
    fastcgi_pass php:9000;

    try_files $uri /index.php;
    include fastcgi.conf;
    fastcgi_keep_conn on;
    fastcgi_intercept_errors on;
    fastcgi_index index.php;
    fastcgi_read_timeout 300;
}

}

from branch master.

I start it with: docker-compose up -d

docker-compose ps show

 Name                    Command                 State       Ports

linkace_app_1 php-fpm -F --pid /opt/bitn ... Up 9000/tcp
linkace_db_1 /opt/bitnami/scripts/maria ... Up 3306/tcp
linkace_nginx_1 /opt/bitnami/scripts/nginx ... Restarting
linkace_redis_1 /opt/bitnami/scripts/redis ... Up 6379/tcp

docker logs linkace_nginx_1 show

nginx 12:38:46.19 INFO ==> ** Starting NGINX **
2020/10/16 12:38:46 [emerg] 1#0: host not found in upstream "php" in /opt/bitnami/nginx/conf/server_blocks/linkace.conf:50
nginx: [emerg] host not found in upstream "php" in /opt/bitnami/nginx/conf/server_blocks/linkace.conf:50

@Kovah
Copy link
Owner

Kovah commented Oct 16, 2020

Sorry, I think things got mixed up in the config files.

In the nginx.conf file change

location ~ \.php$ {
    fastcgi_pass php:9000;

    try_files $uri /index.php;
    ...
}

to

location ~ \.php$ {
    fastcgi_pass app:9000;

    try_files $uri /index.php;
    ...
}

@Kovah Kovah added the Bug Something isn't working label Oct 16, 2020
@Kovah Kovah linked a pull request Oct 16, 2020 that will close this issue
@Kovah Kovah added this to the v0.0.43 milestone Oct 21, 2020
@Kovah Kovah closed this as completed in #159 Nov 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants