Sejam, bem vindos ao primeiro post do blog, bom a ideia é descrever e explicar a instalação e configuração dos serviços: Nginx , php-fpm e mysql no fedora.
Vamos aos passos:
Iniciando a sessão como root
sudo su
Instalação do Mysql
dnf install mysql mysql-server
ativando o serviço
systemctl enable mysqld.service systemctl start mysqld.service
caso tenha o seguinte problema
systemctl enable mysqld.service; Failed to execute operation: No such file or directory
tente o seguinte comando
systemctl enable mariadb systemctl start mariadb
execute o seguinte comando para colocar seus dados de segurança
/usr/bin/mysql_secure_installation
Instalação do servidor NGINX
dnf install nginx
Habilitando serviço
systemctl enable nginx systemctl start nginx
checando status
systemctl status nginx nginx.service - The nginx HTTP and reverse proxy server Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled) Active: active (running) since Dom 2015-07-26 01:14:57 BRT; 57s ago Main PID: 10525 (nginx) CGroup: /system.slice/nginx.service ├─10525 nginx: master process /usr/sbin/nginx ├─10526 nginx: worker process ├─10527 nginx: worker process ├─10528 nginx: worker process └─10529 nginx: worker process
agora é possivel verificar no browser sua disponibilidade (http://localhost/)

Nginx Ativo
Alterando o arquivo de configuração
/etc/nginx/nginx.conf
alterar linha
worker_processes auto;
para worker_processes 4;
Comando para checagem do arquivo de configuração do Nginx
nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
Instalação do PHP-FPM
dnf install php-fpm php-cli php-mysqlnd php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-magickwand php-mbstring php-mcrypt php-mssql php-shout php-snmp php-soap php-tidy php-opcache
checando instalação
php-fpm -v PHP 5.6.11 (fpm-fcgi) (built: Jul 13 2015 15:48:45) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
alterando o arquivo de configuração /etc/php.ini
encontre a linhacgi.fix_pathinfo=1
e alterar para
cgi.fix_pathinfo=0
iniciando serviço
systemctl enable php-fpm.service systemctl start php-fpm.service
Integrando php-fpm ao Nginx
Alterar o arquivo /etc/nginx/nginx.conf
1 – Coloque o trecho de código abaixo dentro do parâmetro “server {”
2 – caso prefira altere também a diretiva root para o path /var/www/html
location ~ \.php$ { root /var/www/html; try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
Após isso pode validar a configuração
nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
Reinicie o servidor
systemctl reload nginx.service
Checando status
systemctl reload nginx.service
crie um arquivo info.php
no diretorio definido em /var/www
com o codigo
<?php phpinfo(); ?>
E aplique
chmod 755 /var/www/info.php
Verificando Resultado no Browser: http://localhost/
Configuração de host
crie um diretorio dentro do seu root
mkdir /var/www/html/meudominio; cp /var/www/html/info.php /var/www/html/meudominio/index.php; chmod 755 /var/www/html/meudominio/index.php
altere o conteúdo do novo arquivo para
<?php echo 'testando o php e algo dinamico aqui '.date('d/m/Y H:i:s'); ?>
copie o arquivo
cp /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/meudominio.conf
Insira o seguinte conteúdo
1 – altere o server_name
2 – altere o caminho do root
server { listen 80; server_name meudominio.local; #root /usr/share/nginx/html; root /var/www/html/meudominio; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { } location ~ \.php$ { root /var/www/html/meudominio; try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } }
altere o arquivo /etc/hosts
127.0.0.1 localhost.localdomain localhost meudominio.local ::1 localhost6.localdomain6 localhost6
insira seu novo host
reinicie o servidor
systemctl reload nginx.service
Verifique o resultado em : (http://meudominio.local/)
evitando dores de cabeça:
desabilitando serviço SELinux (causa bloqueio de streams do php-fpm Permission Denied)
É isso aí espero ter sido claro na explicação. Valeu e até a próxima!