docker_notes:nginx-php-notes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docker_notes:nginx-php-notes [2023-10-15 Sun wk41 11:00] – [nginx executable] baumkpdocker_notes:nginx-php-notes [2024-02-24 Sat wk08 14:19] (current) – [Some reference links] baumkp
Line 1: Line 1:
-======nginx / php notes======+{{tag>linux docker nginx php fast-cgi php-fpm}} 
 +======Docker nginx / php notes======
  
 =====nginx executable===== =====nginx executable=====
-I had some trouble getting nginx with php-fpm to operate.  So I tried to get working a simple setup to nut-out the nuances. +I had some trouble getting nginx with php-fpm to operate.  So I tried to get working a simple setup to nut-out the nuances. <fc #008080>**I got it working using php-fpm socket with Apline Linux on 2 Docker instances, one running Nginx and the other php-fpm.**</fc>  Next try would be a second Nginx in separate Docker and then trying IP TCP connectivity instead of socket file.
  
 To run and control nginx. To run and control nginx.
Line 74: Line 75:
 # PHP only, required if PHP was built with --enable-force-cgi-redirect # PHP only, required if PHP was built with --enable-force-cgi-redirect
 fastcgi_param  REDIRECT_STATUS    200;</code> fastcgi_param  REDIRECT_STATUS    200;</code>
-+++++
  
 See [[https://blog.martinfjordvald.com/nginx-config-history-fastcgi_params-versus-fastcgi-conf/|fastcgi_params Versus fastcgi.conf – Nginx Config History]], basically fastcgi.params is for historical reasons where ''fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;'' has to be separately configured in the location directive. See [[https://blog.martinfjordvald.com/nginx-config-history-fastcgi_params-versus-fastcgi-conf/|fastcgi_params Versus fastcgi.conf – Nginx Config History]], basically fastcgi.params is for historical reasons where ''fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;'' has to be separately configured in the location directive.
 +++++
  
 ++++/etc/nginx/mime.types| ++++/etc/nginx/mime.types|
Line 312: Line 314:
 scgi_param  SERVER_NAME        $server_name; scgi_param  SERVER_NAME        $server_name;
 </code> </code>
-++++ 
  
 [[https://en.wikipedia.org/wiki/Simple_Common_Gateway_Interface|Simple Common Gateway Interface (scgi)]] look like another alternative protocol similar to FastCGI. Probably not relevant unless you intend to use. [[https://en.wikipedia.org/wiki/Simple_Common_Gateway_Interface|Simple Common Gateway Interface (scgi)]] look like another alternative protocol similar to FastCGI. Probably not relevant unless you intend to use.
 +++++
  
 ++++/etc/nginx/uwsgi_params| ++++/etc/nginx/uwsgi_params|
Line 334: Line 336:
 uwsgi_param  SERVER_PORT        $server_port; uwsgi_param  SERVER_PORT        $server_port;
 uwsgi_param  SERVER_NAME        $server_name; </code> uwsgi_param  SERVER_NAME        $server_name; </code>
-++++ 
  
 [[https://uwsgi-docs.readthedocs.io/en/latest/index.html|The uWSGI project]] %%looks like an older module add in for Python, and also other languages. Probably not relevant unless you intend to use.%% [[https://uwsgi-docs.readthedocs.io/en/latest/index.html|The uWSGI project]] %%looks like an older module add in for Python, and also other languages. Probably not relevant unless you intend to use.%%
 +++++
  
 ===/etc/nginx/http.d/=== ===/etc/nginx/http.d/===
Line 389: Line 391:
  }  }
 }</code> }</code>
-++++ 
  
 ''/usr/share/nginx/http-default_server.conf'' is the same as ''/etc/nginx/http.d/default.conf'' listed above. ''/usr/share/nginx/http-default_server.conf'' is the same as ''/etc/nginx/http.d/default.conf'' listed above.
 +++++
  
 ====/var/lib/nginx/html/==== ====/var/lib/nginx/html/====
Line 425: Line 427:
  
 =====basic static site from base setup===== =====basic static site from base setup=====
-Unless otherwise configured nginx reads the configuration file at /etc/nginx/nginx.conf.  This file has dynamic module overrides and root code snippet updates. The main virtual host configuration files are located in sub-directory ''/etc/nginx/http.d''+Unless otherwise configured nginx reads the default configuration file at ''/etc/nginx/nginx.conf''.  I replaced the default ''nginx.conf'' user directive to match that in the ''/etc/php/php-fpm.d/www.conf'' for the socket ''listen.owner'' and ''listen.group'' directives. I do not change the ''www.conf'' ''user'' and ''group'' directives, which are default ''nobody'' This file has dynamic module overrides and root code snippet updates. The main virtual host configuration files are located in sub-directory ''/etc/nginx/http.d''
 ====static web page==== ====static web page====
  
Line 3134: Line 3136:
 ++++ ++++
  
-<- docker_notes:docker-dhcp|Back ^ docker_notes:index|Start page ^ |End->+====Some reference links==== 
 +  *NGINX Docs 
 +    *[[https://nginx.org/en/docs/beginners_guide.html|Beginner’s Guide]] 
 +    *[[https://docs.nginx.com/nginx/admin-guide/monitoring/logging/|Configuring Logging]] 
 +    *[[https://www.nginx.com/resources/wiki/start/topics/examples/fullexample2/|Another Full Example nginx.conf]] 
 +    *[[https://www.nginx.com/resources/wiki/start/topics/examples/phpfcgi/#connecting-nginx-to-php-fpm|PHP FastCGI Example]] 
 +  *php 
 +    *[[https://www.php.net/|php] 
 +    *[[https://www.php.net/manual/en/|PHP Manual]] 
 +  *digitalocean 
 +    *[[https://www.digitalocean.com/community/tutorials/php-fpm-nginx|How to Configure PHP-FPM with NGINX]] 
 +    *[[https://www.digitalocean.com/community/tutorials/understanding-and-implementing-fastcgi-proxying-in-nginx|Understanding and Implementing FastCGI Proxying in Nginx]] 
 +    *[[https://www.digitalocean.com/community/tutorials/nginx-location-directive|Tutorial: Nginx location directive examples]] 
 +  *Stackoverflow 
 +    *[[https://stackoverflow.com/questions/25970711/what-is-the-difference-between-nginx-daemon-on-off-option|What is the difference between nginx daemon on/off option?]] 
 +    *[[https://stackoverflow.com/questions/24208139/nginx-php-fpm-file-not-found|nginx + php-fpm = File not found]] 
 +    *[[https://stackoverflow.com/questions/11954255/how-to-set-index-html-as-root-file-in-nginx|How to set index.html as root file in Nginx?]] 
 +    *[[https://stackoverflow.com/questions/47056062/how-to-connect-nginx-to-php-fpm-using-unix-socket-in-docker|how to connect nginx to php-fpm using unix socket in docker]] 
 +    *[[https://stackoverflow.com/questions/64137225/how-to-setup-a-single-nginx-server-with-multiple-php-fpm-docker-containers|how to setup a single nginx server with multiple php-fpm docker containers]] 
 +    *[[https://stackoverflow.com/questions/49754286/multiple-images-one-dockerfile|Multiple images, one Dockerfile]] 
 +    *[[https://stackoverflow.com/questions/29905953/how-to-correctly-link-php-fpm-and-nginx-docker-containers?rq=4|How to correctly link php-fpm and Nginx Docker containers?]] 
 +    *[[https://stackoverflow.com/questions/44757189/where-is-php7-0-fpm-sock-located|Where is php7.0-fpm.sock located]] 
 +    *[[https://stackoverflow.com/questions/35367676/php-fpm-doesnt-create-sock-file|php-fpm doesn't create .sock file]] 
 +    *[[https://stackoverflow.com/questions/48356981/nginx-index-404-not-found|NGINX Index 404 Not Found]] 
 +  *Miscellaneous: 
 +    *[[https://www.tecmint.com/connect-nginx-to-php-fpm/|How to Connect NGINX to PHP-FPM Using UNIX or TCP/IP Socket]] 
 +    *[[https://www.linode.com/docs/guides/serve-php-php-fpm-and-nginx/|Serve PHP with PHP-FPM and NGINX]] 
 +    *[[https://www.delftstack.com/howto/php/docker-php-fpm/|Set Up PHP-FPM and Nginx Docker Containers]] 
 +    *[[https://marc.it/dockerize-application-with-nginx-and-php8/|Dockerize your PHP application with Nginx and PHP8-FPM]] 
 +    *[[https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/Nginx-PHP-FPM-config-example|How to setup PHP on Nginx with fastCGI (PHP-FPM) example]] 
 +    *[[https://www.plesk.com/blog/various/nginx-configuration-guide/|NGINX Configuration Guide]] 
 +    *[[https://levelup.gitconnected.com/containerizing-nginx-php-fpm-on-alpine-linux-953430ea6dbc|Containerizing nginx + PHP FPM on Alpine Linux]] 
 +    *[[https://medium.com/@shrikeh/setting-up-nginx-and-php-fpm-in-docker-with-unix-sockets-6fdfbdc19f91|Setting up nginx and PHP-FPM in Docker with Unix Sockets]] 
 +    *[[https://www.librebyte.net/en/systems-deployment/how-to-install-php-php-fpm-in-alpine-linux/|How to install PHP, PHP-FPM in Alpine Linux?]] 
 +    *[[https://phoenixnap.com/kb/linux-socket|How Linux Uses Sockets]] 
 +    *[[https://www.sitepoint.com/docker-php-development-environment/|Setting Up a Modern PHP Development Environment with Docker]] 
 +    *[[https://dev.to/texe/how-to-run-nginx-and-php-in-docker-5eoi|How to run Nginx and PHP in Docker]] 
 +    *[[https://github.com/TrafeX/docker-php-nginx|TrafeX/docker-php-nginx]] 
 + 
 +<- docker_notes:/diun-ntfy|Back ^ docker_notes:index|Start page ^ |End->
  • /app/www/public/data/attic/docker_notes/nginx-php-notes.1697338823.txt.gz
  • Last modified: 2023-10-15 Sun wk41 11:00
  • by baumkp