Welcome! Log In Create A New Profile

Advanced

Setting up Nginx Server in FreeBSD- Cant able to include PHP file

Posted by Shilpa 
Setting up Nginx Server in FreeBSD- Cant able to include PHP file
February 02, 2024 12:32PM
Hi, I am new to Nginx and trying to setup multiple website in NGINX server in FreeBSD(OS). I created a folder to save my index.html and test.php file with some text in it, in /usr/local/www/website directory . I installed latest version of php and php-fpm is enabled. In PHP-FPM pool configuration file in /usr/local/etc/php-fpm.d/www.conf , uncommented the listen value. my server block looks like this

server{
listen 80
#the code for this server block
}

server {
listen 443 ssl;
server_name example.com www.example.com;
#ssl certificate code here
root /usr/local/www/website;
index test.php index.html;

# Location for PHP files
location ~ \.php$ {
fastcgi_pass unix:127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

when I try to run this website if I just give my domain name its working properly. but if I run domainname/test.php getting bad getawy error(In error log file the error is : No such file or directory while connecting to upstream)

Since I am new to NGINX and FreeBSD I am stuck here. Can anybody faced such issue or If These is any mistake in my step please let me know.
Thank you
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 258
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready