{"id":4176,"date":"2020-03-31T10:26:16","date_gmt":"2020-03-31T15:26:16","guid":{"rendered":"https:\/\/www.threshold-zero.com\/cblog\/?p=4176"},"modified":"2020-09-06T19:24:54","modified_gmt":"2020-09-07T00:24:54","slug":"getting-php-7-2-to-work-with-nginx-ubuntu","status":"publish","type":"post","link":"https:\/\/www.threshold-zero.com\/cblog\/2020\/03\/getting-php-7-2-to-work-with-nginx-ubuntu\/","title":{"rendered":"Getting PHP 7.2 to work with NGINX (UBUNTU)"},"content":{"rendered":"\n<p>This took a while.  I&#8217;m much, much more familiar with running apache.  I <em>really<\/em> like how fast and light nginx is, though, and was going to start using it, no matter what. <\/p>\n\n\n\n<p>In the end, it was a combination of all of these things:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>When I upgrade to nginx 1.17, there is a new &#8220;include&#8221; line in the nginx.conf file, and suddenly nginx was looking for site config files in this directory (\/etc\/nginx\/conf.d\/) instead of the usual one (\/etc\/nginx\/sites-enabled).  Had to change that first thing.<\/li><li>The nginx process was trying to run under the &#8220;nginx&#8221; user, instead of &#8220;www-data&#8221;.   Basically, the &#8220;user&#8221; config in both your php conf files and your nginx conf files must match, or the php-fpm process ignores the requests from nginx.<\/li><li>Most tutorials I&#8217;ve found on the internet want you to insert specific php-related config into your nginx site config that points php to a certain port, like this: <ul><li><code>\"fastcgi_pass 127.0.0.1:9000;:\".  <\/code><\/li><\/ul><\/li><li>However, my php-fpm was configured to run under a unix socket only (you find this via the &#8220;listen&#8221; param in your php config).  So, I had to add the following line to my nginx site config instead in the php section: <ul><li><code>\"fastcgi_pass unix:\/var\/run\/php\/php7.2-fpm.sock;\"<\/code><\/li><\/ul><\/li><li>I had to include the following line in my php-specific config in my site conf file for nginx.  Even the nginx example conf file is not explicit about this:<ul><li>include snippets\/fastcgi-php.conf;<\/li><\/ul><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>This took a while. I&#8217;m much, much more familiar with running apache. I really like how fast and light nginx is, though, and was going to start using it, no matter what. In the end, it was a combination of all of these things: When I upgrade to nginx 1.17, there is a new &#8220;include&#8221; [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[18,315,31],"tags":[347,348,140],"class_list":["post-4176","post","type-post","status-publish","format-standard","hentry","category-programming","category-server","category-ubuntu","tag-coding","tag-nginx","tag-ubuntu"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2ZUZG-15m","_links":{"self":[{"href":"https:\/\/www.threshold-zero.com\/cblog\/wp-json\/wp\/v2\/posts\/4176","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.threshold-zero.com\/cblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.threshold-zero.com\/cblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.threshold-zero.com\/cblog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.threshold-zero.com\/cblog\/wp-json\/wp\/v2\/comments?post=4176"}],"version-history":[{"count":2,"href":"https:\/\/www.threshold-zero.com\/cblog\/wp-json\/wp\/v2\/posts\/4176\/revisions"}],"predecessor-version":[{"id":4178,"href":"https:\/\/www.threshold-zero.com\/cblog\/wp-json\/wp\/v2\/posts\/4176\/revisions\/4178"}],"wp:attachment":[{"href":"https:\/\/www.threshold-zero.com\/cblog\/wp-json\/wp\/v2\/media?parent=4176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.threshold-zero.com\/cblog\/wp-json\/wp\/v2\/categories?post=4176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.threshold-zero.com\/cblog\/wp-json\/wp\/v2\/tags?post=4176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}