Installation server web
Ngninx - phpfpm
Mettre a jour Brew
brew update
Script pour démarrer les service
nano script_start_service.sh
#!/bin/bash
sudo nginx
sudo nginx -s reload
brew services start php
brew services restart php
Trouver l'emplacement de nginx et ouvrir le fichier conf nginx
brew install nginx
nginx -v
ps aux | grep nginx
cd /usr/local/etc/nginx/
sudo nano nginx.conf
sudo nginx -s reload
Modifier la conf ngninx
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
client_max_body_size 100M;
#gzip on;
server {
listen 8080;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
#include servers/*;
include conf.d/*.conf;
}
Recharger Nginx et créer la conf pour votre serveur nginx
sudo nginx -s reload
nano /usr/local/etc/nginx/logs/phpmyadmin.hereweb.access.log
nano /usr/local/etc/nginx/logs/phpmyadmin.hereweb.error.log
nano /usr/local/etc/nginx/logs/all_acces.log
cd /usr/local/etc/nginx/conf.d/
Conf Serveur php
server {
listen 80; # Port d'écoute pour les requêtes HTTP
access_log /usr/local/etc/nginx/logs/all_acces.log;
access_log /usr/local/etc/nginx/logs/hereweb.access.log;
error_log /usr/local/etc/nginx/logs/hereweb.error.log;
server_name hereweb.me; # Remplacez par votre nom de domaine
root /Users/flo/github/hereweb; # Chemin vers le dossier racine de votre application
index index.php index.html index.htm; # Définition de l'ordre des fichiers index à rechercher
location / {
try_files $uri $uri/ /index.php?$query_string; # Tentative de recherche de fichiers, puis redirection vers index.php si le fichier n'existe pas
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000; # Adresse et port de PHP-FPM
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Stopper Nginx
sudo nginx -s stop
Configurer la redirection url
sudo nano /etc/hosts
Ajouter au fichier
127.0.0.1 localhost hereweb.me
Configurer Mysql
brew install mysql
242 brew services start mysql
246 mysql --help
247 mysql_secure_installation
Configurer php
249 cd /usr/local/etc/php/
250 ls
251 cd 8.2/
252 ls
253 sudo nano php.ini