Ubuntu 16.04, I would like to install the php- fpm on the caddy server


(void) #1

Ubuntu 16.04, I would like to install the php- fpm on the caddy server.

curl -s https://getcaddy.com | bash

sudo mkdir /etc/caddy

sudo chown -R root:www-data /etc/caddy

sudo touch /etc/caddy/Caddyfile

sudo mkdir /etc/ssl/caddy

sudo chown -R www-data:root /etc/ssl/caddy

sudo chmod 0770 /etc/ssl/caddy

sudo mkdir /var/www

sudo chown www-data:www-data /var/www

sudo curl -s https://raw.githubusercontent.com/mholt/caddy/master/dist/init/linux-systemd/caddy.service -o /etc/systemd/system/caddy.service

sudo systemctl daemon-reload

sudo systemctl enable caddy.service

sudo systemctl status caddy.service

sudo ufw allow http
sudo ufw allow https

UFW output

echo ‘<h1>Hello World!</h1>’ | sudo tee /var/www/index.html

sudo nano /etc/caddy/Caddyfile

vi /etc/caddy/Caddyfile

http:// {
root /var/www/html
gzip
fastcgi / unix:/var/run/php-fpm/php-fpm.sock php
}

sudo systemctl start caddy

I installed the caddy server.

And I tried to install php- fpm.

sudo apt-get install php php-mysql php-fpm

Open php.ini
vi /etc/php/7.0/fpm/php.ini, edit

=> cgi.fix_pathinfo=0

Open www.conf:
vi /etc/php/7.0/fpm/pool.d/www.conf, edit

==> listen = /run/php/php7.0-fpm.sock

listen.owner = caddy
listen.group = caddy

user = caddy
group = caddy

sudo systemctl restart php-fpm

error code
Job for php7.0-fpm.service failed because the control process exited with error code. See “systemctl status php7.0-fpm.service” and “journalctl -xe” for details.
root@void-VirtualBox:~# systemctl status php7.0-fpm
● php7.0-fpm.service - The PHP 7.0 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php7.0-fpm.service; enabled; vendor prese
Active: failed (Result: exit-code) since 금 2017-10-27 17:07:53 KST; 6s ago
Process: 10914 ExecStart=/usr/sbin/php-fpm7.0 --nodaemonize --fpm-config /etc/
Process: 10907 ExecStartPre=/usr/lib/php/php7.0-fpm-checkconf (code=exited, st
Main PID: 10914 (code=exited, status=78)

10월 27 17:07:53 void-VirtualBox systemd[1]: Stopped The PHP 7.0 FastCGI Process
10월 27 17:07:53 void-VirtualBox systemd[1]: Starting The PHP 7.0 FastCGI Proces
10월 27 17:07:53 void-VirtualBox php-fpm7.0[10914]: [27-Oct-2017 17:07:53] ERROR
10월 27 17:07:53 void-VirtualBox php-fpm7.0[10914]: [27-Oct-2017 17:07:53] ERROR
10월 27 17:07:53 void-VirtualBox systemd[1]: php7.0-fpm.service: Main process ex
10월 27 17:07:53 void-VirtualBox systemd[1]: Failed to start The PHP 7.0 FastCGI
10월 27 17:07:53 void-VirtualBox systemd[1]: php7.0-fpm.service: Unit entered fa
10월 27 17:07:53 void-VirtualBox systemd[1]: php7.0-fpm.service: Failed with res
lines 1-15/15 (END)…skipping…

Why is this error coming along?
I searched and I do not know

sudo chmod 666 /run/php-fpm/php-fpm.sock
sudo chown caddy:caddy /run/php-fpm/php-fpm.sock
sudo systemctl restart php-fpm


(Matthew Fay) #2

Hi @void,

A lot of those lines are truncated, can you find and paste the full output from journalctl with those php-fpm errors?


(void) #3

I installed the caddy server again from the original code. But I got another error.

sudo systemctl restart php-fpm
Failed to restart php-fpm.service: Unit php-fpm.service not found.

As you requested as requested by Journalctl, it was shown below. I really want to install php 7 on caddy server.


However, the following errors can not be reached.
I am sorry to inform you that if you inform me of your email, I would like to send you my code.

Body is limited to 32000 characters; you entered 67580.
Sorry, new users can only put 4 links in a post.


(Matthew Fay) #4

Use a site like http://pastebin.com/ and link to it here.


(void) #5

thank you, I wrote on that link, yesterday.


(Sayem Chowdhury) #6

Try these method, it should work. However I would recommend Debian 9.x

Step 1

Re-install your OS or purge php*, caddy* and remove user caddy

Step 2

Install caddy installer using wget https://git.io/vra5C -O - -o /dev/null|bash and then install Caddy via executing caddy install or caddy install plugin.name

Step 3

Edit /etc/Caddyfile according to your needs and then start Caddy with caddy start

Let me know if you have still issues, I will try my best to help :slight_smile:


(system) #7

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.