{"id":15027310,"url":"https://github.com/jeijei4/configurar_nginx","last_synced_at":"2026-03-27T04:57:09.104Z","repository":{"id":178971227,"uuid":"662636111","full_name":"jeijei4/Configurar_Nginx","owner":"jeijei4","description":"Configurar Nginx con php-fpm y obtener la URI con PATH_INFO","archived":false,"fork":false,"pushed_at":"2023-07-11T16:47:09.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-13T03:15:41.418Z","etag":null,"topics":["http2","nginx","path-info","php-fpm","php81","ssl-certificate","uri"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jeijei4.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-05T14:54:57.000Z","updated_at":"2023-07-05T15:33:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"7a60a1d6-95d7-43df-a699-9487bacdbfcd","html_url":"https://github.com/jeijei4/Configurar_Nginx","commit_stats":null,"previous_names":["jeijei4/configurar_nginx"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeijei4%2FConfigurar_Nginx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeijei4%2FConfigurar_Nginx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeijei4%2FConfigurar_Nginx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeijei4%2FConfigurar_Nginx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jeijei4","download_url":"https://codeload.github.com/jeijei4/Configurar_Nginx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243330319,"owners_count":20274039,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["http2","nginx","path-info","php-fpm","php81","ssl-certificate","uri"],"created_at":"2024-09-24T20:06:10.728Z","updated_at":"2025-12-29T02:07:10.430Z","avatar_url":"https://github.com/jeijei4.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Configurar Nginx\n\n### Ajustar php-fpm:\n\u003ccode\u003e/etc/php-fpm.d/www.conf\u003c/code\u003e\n```ini\n[www]\nuser = nginx\ngroup = nginx\nlisten = /run/php-fpm/www.sock\n; listen = 127.0.0.1:9000\nlisten.owner = nginx\nlisten.group = nginx\nlisten.mode = 0660\nlisten.acl_users = nginx\nlisten.allowed_clients = 127.0.0.1\npm = dynamic\npm.max_children = 50\npm.start_servers = 5\npm.min_spare_servers = 5\npm.max_spare_servers = 35\nslowlog = /var/log/php-fpm/www-slow.log\n```\n\n\n### Configuración básica de Nginx con \u003ccode\u003ePATH_INFO\u003c/code\u003e:\n\u003ccode\u003e/etc/nginx/nginx.conf\u003c/code\u003e\n```nginx\nserver {\n    listen 80 default_server;\n    listen [::]:80 default_server;\n    server_name demo.localhost;\n\n    # Prevent nginx HTTP Server Detection\n    server_tokens off;\n\n    # Enforce HTTPS\n    return 301 https://$server_name$request_uri;\n\t#return 301 https://$host$request_uri;\n}\n\nserver {\n    listen       443 ssl http2;\n    listen       [::]:443 ssl http2;\n\n    server_name             demo.localhost;\n    root                    \"/var/www/html/proyect/public\";\n    ssl_certificate         \"/ssl/certificate.crt\";\n    ssl_certificate_key     \"/ssl/certificate.key\";\n    ssl_trusted_certificate \"/ssl/CA.crt\";\n\n    server_tokens off; # Prevent nginx HTTP Server Detection\n\n    index index.php index.html /index.php$request_uri;\n\n    location ~ \\.php(?:$|/) {\n        fastcgi_split_path_info ^(.+?\\.php)(/.*)$;\n        set $path_info $fastcgi_path_info;\n        try_files $fastcgi_script_name =404;\n\n        fastcgi_pass unix:/run/php-fpm/www.sock;\n        fastcgi_index /index.php;\n\n        include /etc/nginx/fastcgi_params;\n        fastcgi_param PATH_INFO       $path_info;\n        fastcgi_param PATH_TRANSLATED $document_root$path_info;\n        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n    }\n\n    location / {\n        try_files $uri $uri/ /index.php$request_uri;\n    }\n\n    location ~ /\\. {\n        deny all;\n    }\n}\n```\n\n## Obtener la URI en PHP \u003ccode\u003e\u003ci\u003e^8.1\u003c/i\u003e\u003c/code\u003e\n```php\n$uri = $_SERVER['PATH_INFO'] ?? '/';\necho $uri;\n```\n\n### Reiniciar\n```shell\nsystemctl restart nginx php-fpm\n```\n\n## Créditos\n[\u003ccode\u003eNextcloud\u003c/code\u003e](https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html#nextcloud-in-the-webroot-of-nginx)\n[\u003ccode\u003eMozilla\u003c/code\u003e](https://ssl-config.mozilla.org/#server=nginx\u0026version=1.20.1\u0026config=modern\u0026openssl=3.0.7\u0026guideline=5.7)\n[\u003ccode\u003eKumbiaPHP\u003c/code\u003e](https://github.com/KumbiaPHP/Documentation/blob/master/es/to-install.md#configurar-nginx)\n[\u003ccode\u003eComputingforgeeks\u003c/code\u003e](https://computingforgeeks.com/install-php-8-on-rocky-linux-almalinux-8/?expand_article=1)\n[\u003ccode\u003eNginx\u003c/code\u003e](https://www.nginx.com/resources/wiki/start/topics/examples/phpfcgi)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeijei4%2Fconfigurar_nginx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeijei4%2Fconfigurar_nginx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeijei4%2Fconfigurar_nginx/lists"}