{"id":361,"date":"2023-06-04T22:15:51","date_gmt":"2023-06-05T05:15:51","guid":{"rendered":"https:\/\/anilot.tk\/blog\/?p=361"},"modified":"2023-06-05T00:02:26","modified_gmt":"2023-06-05T07:02:26","slug":"fix-wordpress-http-500-with-caddy2","status":"publish","type":"post","link":"https:\/\/anilot.net\/blog\/index.php\/2023\/06\/04\/fix-wordpress-http-500-with-caddy2\/","title":{"rendered":"Fix WordPress HTTP 500 with Caddy2"},"content":{"rendered":"<div class='booster-block booster-read-block'>\n                <div class=\"twp-read-time\">\n                \t<i class=\"booster-icon twp-clock\"><\/i> <span>Read Time:<\/span>1 Minute, 30 Second                <\/div>\n\n            <\/div>\n<p class=\"wp-block-paragraph\">I upgraded my Unbuntu recently to 22.04LTS. In the process, the php-fpm was updated too to 8.1. This resulted in 500 errors for WordPress and permission issues to update WordPress themes as it requires FTP info &#8220;To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host&#8221;. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To fix the issue, I have to update the php-fpm configs similar to this post when I <a href=\"https:\/\/anilot.tk\/blog\/index.php\/2020\/06\/12\/how-to-set-up-wordpress-with-caddy-2\/\">first set up WordPress on Caddy 2<\/a>. <\/p>\n\n\n\n<h3 class=\"wp-block-heading has-large-font-size\">Fix the Caddyfile to point to the updated php-fpm <\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo vim Caddyfile<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Change the lines where Caddy calls the php-fpm listener, replace the correct version of php-fpm located under \/run\/php<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php_fastcgi unix\/\/run\/php\/php8.1-fpm.sock<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Don&#8217;t forget to reload the Caddyfile to apply the changes<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo systemctl reload caddy<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Configure php-fpm to work with Caddy2<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To ensure WordPress has the correct write permission after being served by Caddy, we need to update the PHP-FPM config. Otherwise, WordPress might throw out \u201cerror occurred while updating\u201d during theme update, or require FTP access to install any themes or plugins, or plainly throw HTTP 500. To do this, you will need to modify the FPM pool config. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the FPM Pool config file, change the&nbsp;<code>listen.group<\/code>,&nbsp;<code>listen.user<\/code>,&nbsp;<code>user<\/code>&nbsp;and&nbsp;<code>group<\/code>&nbsp;to&nbsp;<code>caddy<\/code>, or the username created to run the Caddy server.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo vim \/etc\/php\/8.1\/fpm\/pool.d\/www.conf<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then restart PHP-FPM service to apply the changes<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo service php8.1-fpm restart<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Check if WordPress is Working with Caddy 2<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In browser, go to https:\/\/yourdomain.com\/wordpress and WordPress should be running. <\/p>\n        <div class=\"booster-block booster-reactions-block\">\n            <div class=\"twp-reactions-icons\">\n                \n                <div class=\"twp-reacts-wrap\">\n                    <a react-data=\"be-react-1\" post-id=\"361\" class=\"be-face-icons un-reacted\" href=\"javascript:void(0)\">\n                        <img decoding=\"async\" src=\"https:\/\/anilot.net\/blog\/wp-content\/plugins\/booster-extension\/\/assets\/icon\/happy.svg\" alt=\"Happy\">\n                    <\/a>\n                    <div class=\"twp-reaction-title\">\n                        Happy                    <\/div>\n                    <div class=\"twp-count-percent\">\n                                                    <span style=\"display: none;\" class=\"twp-react-count\">0<\/span>\n                        \n                                                <span class=\"twp-react-percent\"><span>0<\/span> %<\/span>\n                                            <\/div>\n                <\/div>\n\n                <div class=\"twp-reacts-wrap\">\n                    <a react-data=\"be-react-2\" post-id=\"361\" class=\"be-face-icons un-reacted\" href=\"javascript:void(0)\">\n                        <img decoding=\"async\" src=\"https:\/\/anilot.net\/blog\/wp-content\/plugins\/booster-extension\/\/assets\/icon\/sad.svg\" alt=\"Sad\">\n                    <\/a>\n                    <div class=\"twp-reaction-title\">\n                        Sad                    <\/div>\n                    <div class=\"twp-count-percent\">\n                                                    <span style=\"display: none;\" class=\"twp-react-count\">0<\/span>\n                                                                        <span class=\"twp-react-percent\"><span>0<\/span> %<\/span>\n                                            <\/div>\n                <\/div>\n\n                <div class=\"twp-reacts-wrap\">\n                    <a react-data=\"be-react-3\" post-id=\"361\" class=\"be-face-icons un-reacted\" href=\"javascript:void(0)\">\n                        <img decoding=\"async\" src=\"https:\/\/anilot.net\/blog\/wp-content\/plugins\/booster-extension\/\/assets\/icon\/excited.svg\" alt=\"Excited\">\n                    <\/a>\n                    <div class=\"twp-reaction-title\">\n                        Excited                    <\/div>\n                    <div class=\"twp-count-percent\">\n                                                    <span style=\"display: none;\" class=\"twp-react-count\">0<\/span>\n                                                                        <span class=\"twp-react-percent\"><span>0<\/span> %<\/span>\n                                            <\/div>\n                <\/div>\n\n                <div class=\"twp-reacts-wrap\">\n                    <a react-data=\"be-react-6\" post-id=\"361\" class=\"be-face-icons un-reacted\" href=\"javascript:void(0)\">\n                        <img decoding=\"async\" src=\"https:\/\/anilot.net\/blog\/wp-content\/plugins\/booster-extension\/\/assets\/icon\/sleepy.svg\" alt=\"Sleepy\">\n                    <\/a>\n                    <div class=\"twp-reaction-title\">\n                        Sleepy                    <\/div>\n                    <div class=\"twp-count-percent\">\n                                                    <span style=\"display: none;\" class=\"twp-react-count\">0<\/span>\n                        \n                                                <span class=\"twp-react-percent\"><span>0<\/span> %<\/span>\n                                            <\/div>\n                <\/div>\n\n                <div class=\"twp-reacts-wrap\">\n                    <a react-data=\"be-react-4\" post-id=\"361\" class=\"be-face-icons un-reacted\" href=\"javascript:void(0)\">\n                        <img decoding=\"async\" src=\"https:\/\/anilot.net\/blog\/wp-content\/plugins\/booster-extension\/\/assets\/icon\/angry.svg\" alt=\"Angry\">\n                    <\/a>\n                    <div class=\"twp-reaction-title\">Angry<\/div>\n                    <div class=\"twp-count-percent\">\n                                                    <span style=\"display: none;\" class=\"twp-react-count\">0<\/span>\n                                                                        <span class=\"twp-react-percent\"><span>0<\/span> %<\/span>\n                        \n                    <\/div>\n                <\/div>\n\n                <div class=\"twp-reacts-wrap\">\n                    <a react-data=\"be-react-5\" post-id=\"361\" class=\"be-face-icons un-reacted\" href=\"javascript:void(0)\">\n                        <img decoding=\"async\" src=\"https:\/\/anilot.net\/blog\/wp-content\/plugins\/booster-extension\/\/assets\/icon\/surprise.svg\" alt=\"Surprise\">\n                    <\/a>\n                    <div class=\"twp-reaction-title\">Surprise<\/div>\n                    <div class=\"twp-count-percent\">\n                                                    <span style=\"display: none;\" class=\"twp-react-count\">0<\/span>\n                                                                        <span class=\"twp-react-percent\"><span>0<\/span> %<\/span>\n                                            <\/div>\n                <\/div>\n\n            <\/div>\n        <\/div>\n\n    ","protected":false},"excerpt":{"rendered":"<p>I upgraded my Unbuntu recently to 22.04LTS. In the process, the php-fpm was updated too to 8.1. This resulted in 500 errors for WordPress and&hellip;<\/p>\n","protected":false},"author":1,"featured_media":365,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"ai_generated_summary":"","_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_post_was_ever_published":false},"categories":[7],"tags":[11,12,13],"class_list":["post-361","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech","tag-caddy","tag-web-server","tag-wordpress","has-post-thumbnail-archive"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/anilot.net\/blog\/wp-content\/uploads\/2023\/06\/pexels-photo-4160094.jpeg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/anilot.net\/blog\/index.php\/wp-json\/wp\/v2\/posts\/361","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/anilot.net\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/anilot.net\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/anilot.net\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/anilot.net\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=361"}],"version-history":[{"count":2,"href":"https:\/\/anilot.net\/blog\/index.php\/wp-json\/wp\/v2\/posts\/361\/revisions"}],"predecessor-version":[{"id":367,"href":"https:\/\/anilot.net\/blog\/index.php\/wp-json\/wp\/v2\/posts\/361\/revisions\/367"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/anilot.net\/blog\/index.php\/wp-json\/wp\/v2\/media\/365"}],"wp:attachment":[{"href":"https:\/\/anilot.net\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anilot.net\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anilot.net\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}