Jump to content

FreeBSD - Setup Nginx + php 8.1


Mensajes recomendados

Hello community,

In this guide I'm going to teach you how to install nginx + php 8.1 on freebsd.

Step by Step
 

# Install the packages
pkg install -y php81 nginx
pkg install -y php81-extensions php81-mysqli php81-mbstring php81-curl php81-gd

# Start the services when starting the operating system
sysrc nginx_enable=yes
sysrc php_fpm_enable=YES

# Start the services
service nginx start
service php-fpm start

# Create the directory
/var/www

# Replace the server { in: @/usr/local/etc/nginx/nginx.conf
    server {
        listen       80;
        server_name  localhost;
		
		root   /var/www;
        index  index.php index.html index.htm;

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

        location ~ \.php$ {
			try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME $request_filename;
            include        fastcgi_params;
        }
		
        location ~ /\.ht {
            deny  all;
        }
    }
 
# Restart nginx
service nginx restart

# Done! You can place the web files in the directory: @/var/www

 

Enlace para comentar
Compartir en otros sitios

Unirse a la conversación

Puedes publicar ahora y registrarte más tarde. Si tienes una cuenta, regístrate para publicar con su cuenta.

Guest
Responder a este tema...

×   Has pegado contenido con formato .   Eliminar formato

  Only 75 emoji are allowed.

×   Tu enlace se ha incorporado automáticamente.   Mostrar un enlace en su lugar

×   Se ha restaurado el contenido anterior. .   Borrar editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recientemente navegando por este tema   0 miembros

    • No hay usuarios registrados visitando esta página.
×
×
  • Crear nuevo...