h5bp / server-configs-nginx

Nginx HTTP server boilerplate configs
MIT License
11.2k stars 1.53k forks source link

how to configure php #296

Closed awmbtc closed 2 years ago

awmbtc commented 2 years ago

I installed php myself, installed nginx myself and downloaded all the files from server-configs-nginx to my nginx directory.

How should I configure php in nginx?

For example, which configuration file should I put the following code in? location / {

This changes the name of the index file that defines the home page

        index index.php index.html index.htm;
    }

location ~ .php$ {

Set the listening port

        fastcgi_pass 127.0.0.1:9000;
        # Set the default home page file for nginx (which has been set above and can be removed)
        fastcgi_index index.php;
        # Set the path of the script file request
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        # Introduce the fastcgi configuration file
        include fastcgi_params;
    }
LeoColomb commented 2 years ago

This is duplicate of previously answered #295. I'm pretty sure Internet is full of how-to guides and explanation on local configuration. In case you are not able to find a proper solution by yourself, please contact a specialist.

awmbtc commented 2 years ago

This is duplicate of previously answered #295. I'm pretty sure Internet is full of how-to guides and explanation on local configuration. In case you are not able to find a proper solution by yourself, please contact a specialist.

Where is the parameter that specifies the index file name? Where should the parameters for adding php support be placed?

quantumpacket commented 2 years ago

@awmbtc this is not a technical support channel. This is meant for reporting issues for the contents of this repository. When you open multiple issues you spam the inboxes of nearly 400 people watching this repository. If you need technical support on how to use Nginx read their documentation or reach out on the multitude of outlets for getting technical support (chatrooms, IRC, QA sites, etc...)

awmbtc commented 2 years ago

@awmbtc this is not a technical support channel. This is meant for reporting issues for the contents of this repository. When you open multiple issues you spam the inboxes of nearly 400 people watching this repository. If you need technical support on how to use Nginx read their documentation or reach out on the multitude of outlets for getting technical support (chatrooms, IRC, QA sites, etc...) I got it, but there is almost no documentation on google about deploying php for this project. I'm sorry, I'm a rookie who doesn't know anything about code at all, so I have to ask for help here. Again, sorry to bother you, I won't post again!

Dreamsorcerer commented 2 years ago

As per the README, server definitions go in conf.d/. What goes into the server definitions is general to nginx, not something that is specific to this project. So, have a look at the nginx guides (also linked at the top of the README).