{"id":943,"date":"2017-09-02T22:31:12","date_gmt":"2017-09-03T01:31:12","guid":{"rendered":"http:\/\/wordpress.jpcorp.eti.br\/?p=943"},"modified":"2021-12-26T12:30:43","modified_gmt":"2021-12-26T15:30:43","slug":"linux-instalando-nginx-engine-x-php","status":"publish","type":"post","link":"https:\/\/wordpress.jpcorp.eti.br\/?p=943","title":{"rendered":"Linux &#8211; Instalando Nginx (Engine X) + PHP"},"content":{"rendered":"<p>Eae bora instalar o Nginx com PHP?<\/p>\n<p>Documenta\u00e7\u00e3o: https:\/\/nginx.org\/en\/linux_packages.html<\/p>\n<p>&nbsp;<\/p>\n<h3>1 - Adicionar o reposit\u00f3rio e instalar o pacote<\/h3>\n<pre class=\"lang:sh decode:true\">[root@centos tmp]# vim \/etc\/yum.repos.d\/nginx.repo\r\n\r\n[nginx]\r\nname=nginx repo\r\nbaseurl=http:\/\/nginx.org\/packages\/centos\/7\/$basearch\/\r\ngpgcheck=0\r\nenabled=1<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"lang:sh decode:true\">[root@centos tmp]# yum install nginx php php-common php-fpm<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"lang:sh decode:true\">[root@centos tmp]# systemctl stop httpd\r\n[root@centos tmp]# systemctl disable httpd\r\n[root@centos tmp]# systemctl enable nginx\r\n[root@centos tmp]# systemctl start nginx<\/pre>\n<p>&nbsp;<\/p>\n<h3 class=\"lang:sh decode:true \">2 - Editar os arquivos de conf<\/h3>\n<pre class=\"lang:sh decode:true\">[root@centos tmp]# vim \/etc\/php.ini\r\n\r\ncgi.fix_pathinfo=0<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"lang:sh decode:true\">[root@centos tmp]# vim \/etc\/php-fpm.d\/www.conf\r\n\r\n;listen = 127.0.0.1:9000\r\nlisten = \/var\/run\/php-fpm\/php-fpm.sock\r\nlisten.owner = nobody\r\nlisten.group = nobody\r\nuser = nginx\r\ngroup = nginx\r\n\r\n[root@centos tmp]# systemctl restart php-fpm<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"lang:sh decode:true\">[root@centos tmp]# cp \/etc\/nginx\/conf.d\/default.conf \/mnt\/\r\n[root@centos tmp]# vim \/etc\/nginx\/conf.d\/default.conf\r\n\r\nserver {\r\n    listen       80;\r\n    server_name  192.168.1.39;\r\n\r\n    # note that these lines are originally from the \"location \/\" block\r\n    root   \/usr\/share\/nginx\/html;\r\n    index index.php index.html index.htm;\r\n\r\n    location \/ {\r\n        try_files $uri $uri\/ =404;\r\n    }\r\n    error_page 404 \/404.html;\r\n    error_page 500 502 503 504 \/50x.html;\r\n    location = \/50x.html {\r\n        root \/usr\/share\/nginx\/html;\r\n    }\r\n\r\n    location ~ \\.php$ {\r\n        try_files $uri =404;\r\n        fastcgi_pass unix:\/var\/run\/php-fpm\/php-fpm.sock;\r\n        fastcgi_index index.php;\r\n        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\r\n        include fastcgi_params;\r\n    }\r\n}\r\n\r\n[root@centos tmp]# systemctl restart nginx<\/pre>\n<p>&nbsp;<\/p>\n<h3>3 - Criar phpinfo.php e validar<\/h3>\n<pre class=\"lang:sh decode:true\">[root@centos tmp]# vim \/usr\/share\/nginx\/html\/phpinfo.php\r\n\r\n&lt;?php\r\n\tphpinfo();\r\n?&gt;\r\n\r\nhttp:\/\/seu_ipaddress\/phpinfo.php<\/pre>\n<p>&nbsp;<\/p>\n<p>Refer\u00eancias:<\/p>\n<p><a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-install-linux-nginx-mysql-php-lemp-stack-on-centos-7\">https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-install-linux-nginx-mysql-php-lemp-stack-on-centos-7<\/a><\/p>\n<p>https:\/\/www.tecmint.com\/install-nginx-mariadb-php-rhel-centos-fedora\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Eae bora instalar o Nginx com PHP? Documenta\u00e7\u00e3o: https:\/\/nginx.org\/en\/linux_packages.html &nbsp; 1 &#8211; Adicionar o reposit\u00f3rio e instalar o pacote [root@centos tmp]# vim \/etc\/yum.repos.d\/nginx.repo [nginx] name=nginx repo baseurl=http:\/\/nginx.org\/packages\/centos\/7\/$basearch\/ gpgcheck=0 enabled=1 &nbsp; [root@centos tmp]# yum install nginx php php-common php-fpm &nbsp; [root@centos tmp]# systemctl stop httpd [root@centos tmp]# systemctl disable httpd [root@centos tmp]# systemctl enable nginx [root@centos&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[9,77],"class_list":["post-943","post","type-post","status-publish","format-standard","hentry","category-linux","tag-linux","tag-nginx"],"_links":{"self":[{"href":"https:\/\/wordpress.jpcorp.eti.br\/index.php?rest_route=\/wp\/v2\/posts\/943","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.jpcorp.eti.br\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.jpcorp.eti.br\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.jpcorp.eti.br\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.jpcorp.eti.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=943"}],"version-history":[{"count":2,"href":"https:\/\/wordpress.jpcorp.eti.br\/index.php?rest_route=\/wp\/v2\/posts\/943\/revisions"}],"predecessor-version":[{"id":945,"href":"https:\/\/wordpress.jpcorp.eti.br\/index.php?rest_route=\/wp\/v2\/posts\/943\/revisions\/945"}],"wp:attachment":[{"href":"https:\/\/wordpress.jpcorp.eti.br\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=943"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.jpcorp.eti.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=943"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.jpcorp.eti.br\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=943"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}