{"id":4975,"date":"2019-08-14T09:58:44","date_gmt":"2019-08-14T04:28:44","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=4975"},"modified":"2019-08-14T10:01:08","modified_gmt":"2019-08-14T04:31:08","slug":"websites-hosted-on-plesk-server-often-results-with-502-bad-gateway","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/websites-hosted-on-plesk-server-often-results-with-502-bad-gateway\/","title":{"rendered":"Websites hosted on Plesk server often results with 502 Bad Gateway"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">Websites hosted on Plesk server often results with 502 Bad Gateway<\/h3>\n\n\n\n<h3 class=\"wp-block-heading\">Introduction<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Most importantly, websites are unavailable and often result in 502 Bad gateway in the Plesk server. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Root cause <\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A request cannot be processed by the proxy server because of insufficient buffer size.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the log files&nbsp;<code>\/var\/log\/nginx\/error.log<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Consequently, in the following error message can be found &#8220;upstream sent too big header while reading response header&#8221;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Sample error log:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>[error] 13690#0: *244 upstream sent too big header while reading response header from upstream, client: x.x.x.x, server: subdomain.example.com, request: \"POST \/admin_catalog.php HTTP\/1.1\", upstream: \"http:\/\/x.x.x.x\/admin_catalog.php\", host: \"subdomain.example.com\", referrer: \"http:\/\/subdomain.example.com\/admin_catalog.php\"<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Solution<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">For one or two domains [In specific]<\/h4>\n\n\n\n<ol class=\"wp-block-list\"><li>Log in to Plesk panel, firstly.<\/li><li>Go to\u00a0<strong>Domains &gt; zzz.com &gt; PHP Settings<\/strong>\u00a0and check the selected PHP handler (the field\u00a0<strong>run PHP as<\/strong>). <\/li><li>Go to\u00a0<strong>Domains &gt; zzz.com &gt; Apache &amp; nginx Settings<\/strong>, scroll down to the field\u00a0<strong>Additional nginx directives<\/strong>.<br><br>And also set the following parameters in accordance with the used PHP handler:<ul><li>For PHP handler\u00a0<strong>FPM application served by Nginx<\/strong>:<br><br>fastcgi_buffers 8 16k;<br>fastcgi_buffer_size 32k;<\/li><\/ul><\/li><li><strong>For other PHP handlers<\/strong>:<br><br>proxy_buffers 8 16k;<br>proxy_buffer_size 32k;<\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Above all, increase the values of these parameters if it is needed.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">For all the domains in Plesk <\/h4>\n\n\n\n<ol class=\"wp-block-list\"><li>Secondly, connect to the server\u00a0using SSH.<br><\/li><li>Open and edit the file\u00a0<code>\/etc\/nginx\/nginx.conf<\/code>\u00a0<br><\/li><li>For instance, increase the following parameters in the section\u00a0<code>http {<\/code>:<br><br>proxy_buffers 8 16k;<br>proxy_buffer_size 32k;\u00a0<br>fastcgi_buffers 8 16k;\u00a0<br>fastcgi_buffer_size 32k;<br><\/li><li>Then, restart nginx to apply changes:<br><br>#\u00a0service nginx restart<\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks for using&nbsp;<a href=\"https:\/\/pheonixsolutions.com\/\">pheonix solutions<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Websites hosted on Plesk server often results with 502 Bad Gateway Introduction Most importantly, websites are unavailable and often result [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_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":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1019],"tags":[704,264,705],"class_list":["post-4975","post","type-post","status-publish","format-standard","hentry","category-cloud-aws","tag-502-bad-gateway","tag-plesk","tag-upstream-sent-too-big-header-while-reading-response-header","psol-cat-cloud-aws"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-1if","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4975","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=4975"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4975\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=4975"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=4975"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=4975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}