Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

732
Views
Configuración del servidor Nginx para codeigniter en docker, múltiples aplicaciones

Tengo index.php y manager.php para esas 2 aplicaciones en la raíz, configuradas a través de la ventana acoplable con nginx, phpfpm y algunas otras dependencias.

Este es mi archivo docker-compose, puse solo las partes importantes.

 services: web: container_name: web build: context: ./ dockerfile: docker/nginx/Dockerfile volumes: - ./:/var/www ports: - 80 depends_on: - app environment: VIRTUAL_HOST: ${VIRTUAL_HOSTS} VIRTUAL_PORT: 80 networks: - nginx-proxy - my-app app: container_name: app build: context: ./ dockerfile: docker/php/Dockerfile volumes: - ./:/var/www depends_on: - mysql ports: - 9000 networks: - my-app ...

Y este es mi archivo vhost, probé todo lo que sabía o encontré en Internet para que funcionara sin éxito, esta es la forma final, por supuesto, todavía no funciona.

 server { listen 80; server_name myapplication.local; index index.php index.html; root /var/www; location / { try_files $uri $uri/ =404; } location /manager.php { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass app:9000; fastcgi_index manager.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass app:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; } try_files $uri $uri/ /index.php; if (!-e $request_filename){ rewrite ^/(.*)$ /index.php?/$1? last; } location ~ /\.ht { deny all; } location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { log_not_found off; access_log off; allow all; } location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ { expires max; log_not_found off; } sendfile off; }

Si accedo a la aplicación normal, funciona bien, si voy a /manager.php o /manager.php/* obtengo 404, ¿alguien sabe cómo puedo configurar nginx para que funcione en esta situación? ¡Gracias!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Encontré la solución:

 server { listen 80; server_name myapplication.local; index index.php index.html manager.php; root /var/www; location / { try_files $uri $uri/ =404; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass app:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; } try_files $uri $uri/ /index.php /manager.php; if (!-e $request_filename){ rewrite ^/manager.php/(.*)$ /manager.php?/$1? last; rewrite ^/(.*)$ /index.php?/$1? last; } location ~ /\.ht { deny all; } location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { log_not_found off; access_log off; allow all; } location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ { expires max; log_not_found off; } sendfile off; }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!