Welcome! Log In Create A New Profile

Advanced

Php in Nginx on OpenSUSE Linux virtual machine.

Posted by Russell1 
Php in Nginx on OpenSUSE Linux virtual machine.
January 22, 2022 09:31AM
NAME = "openSUSE LEAP."
VERSION = "15.0."
PHP 7.2.5 ( cli ) ( NTS ).

Using php7 with Nginx in openSUSE Linux. Two examples of code as follows:

1.
server {
listen 80;
root /srv/www/htdocs/;
index index1.php index_1-7.html index_1-7.htm;
server_name www.study2.holybible1.ddnsfree.com study2.holybible1.ddnsfree.com;

location / {
try_files $uri $uri/ =404;
}

location ~ \.php$ {
include /etc/php7/fpm/php-fpm.conf;
fastcgi_pass unix: /var/run/php7-fpm.sock;
}
}

At Linux command prompt, type:

$sudo nginx -t <cr>

Output:

nginx: [emerg] unexpected ";" in /etc/php7/fpm/php-fpm.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed.

What do I need to do to solve this problem?

2.
server {
listen 80;
listen [::]:80 default_server ipv6only=on;
server_name www.study.holybible1.ddnsfree.com study.holybible1.ddnsfree.com;

location / {
root /srv/www/htdocs/;
index index_1-7.html index_1-7.htm index1.php;
}
}

server {
listen 80;
root /srv/www/htdocs/;
server_name localhost;

location ~ \.php$ {
root /srv/www/htdocs/;
fastsci_pass 127.0.0.1:9000;
fastcgi_buffer_size 4k;
fastcgi_buffering on;
fastcgi_busy_buffers_size 8k;
fastcgi_index index1.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
include fastcgi_params;
}
}

At the Linux command prompt, type:

$sudo nginx -t <cr>

Output:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

With option "2," when I type "My_Linux_virtual_machine_IP_address"/index1.php, in the address bar of my web browser in my Linux virtual machine, I receive a dialogue box to download the ".php" file, instead of the contents of the ".php" file being displayed to the web browser. How do I solve this problem?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 240
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