@mac
To install PHP in nginx, follow these steps:
1
|
sudo apt install nginx |
1
|
sudo apt install php-fpm |
1
|
sudo nano /etc/nginx/sites-available/default |
1 2 3 4 |
location ~ .php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.4-fpm.sock; } |
1
|
sudo nginx -t |
1
|
sudo systemctl restart nginx |
That's it! PHP is now installed and configured in nginx. You can create PHP files in your web root directory (usually /var/www/html
) and access them through your web browser.
@mac
To install PHP in Nginx, you need to follow these steps:
PHP should now be installed and configured with Nginx. You can test it by creating a simple PHP file in the webroot directory (/var/www/html
) and accessing it through a web browser.