Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy CaddyWEB server software under Linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to deploy CaddyWEB server software under Linux". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to deploy CaddyWEB server software under Linux".

Environmental information

System: Centos8

Hostname: caddy.example.com

IP address: 192.168.43.131

Install the Caddy Web server

Install caddy using the following command:

[root@caddy ~] # yum-y install 'dnf-command (copr)' [root@caddy ~] # yum copr enable @ caddy/ Caddy [root @ caddy ~] # yum-y install caddy

Locate the installation directory of the Caddy Web server:

[root@caddy ~] # whereis caddycaddy: / usr/bin/caddy / etc/caddy / usr/share/caddy

CentOS 8 install Caddy Web server CentOS 8 install Caddy Web server create directory structure for Caddy Web server

The following directory is created for the Caddy service to store the certificate:

[root@caddy ~] # mkdir / etc/ssl/caddy [root@caddy ~] # chown-R caddy:root / etc/ssl/caddy/ [root@caddy ~] # chmod o-rwx / etc/ssl/caddy/ enable caddy service [root@caddy ~] # systemctl enable caddyCreated symlink / etc/systemd/system/multi-user.target.wants/caddy.service → / usr/lib/systemd/system/caddy.service. [root@caddy ~] # systemctl start caddy

Enter the server ip address in the browser to access the default page of the default Caddy.

Create a server configuration in Caddyfile

Create a simple server configuration in the Caddyfile file:

[root@caddy ~] # vim / etc/caddy/Caddyfile:80 {# Set this path to your site's directory.root * / var/www/html# Enable the static file server.file_servergzip# Another common task is to set up a reverse proxy:# reverse_proxy localhost:8080# Or serve a PHP site through php-fpm:# php_fastcgi localhost:9000} [root@caddy html] # echo "Hello World" > / var/www/html/index.html

Restart the caddy service:

[root@localhost ~] # systemctl restart caddy

Visit and test:

Firewall enabled http:

[root@localhost ~] # firewall-cmd-- permanent-- add-service=httpsuccess [root@localhost ~] # firewall-cmd-- Thank you for reading. The above is the content of "how to deploy CaddyWEB server software under Linux". After the study of this article, I believe you have a deeper understanding of how to deploy CaddyWEB server software under Linux, and the specific usage needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report