分类 Linux教程 中的文章

安装 Caddy PHP

下载 Caddy $ wget https://dl.lamp.sh/files/caddy_linux_amd64 $ mv caddy_linux_amd64 caddy $ chmod +x caddy 安装 PHP $ apt install -y php7.3 php7.3-fpm php7.3-cli php7.3-sqlite3 php7.3-curl php7.3-gd php7.3-mbstring php7.3-xml 配置 PHP $ nano /etc/php/7.3/fpm/pool.d/www.conf 取消以下相关配置项的注释 listen.owner = www-data listen.group = www-data listen.mode = 0660 设置 PHP 开机启动 $ systemctl start php7.3-fpm $ systemctl enable php7.3-fpm 设置网站目录组和拥有者为 www-data $ chown www-data:www-data -R /home/app/typecho/……

阅读全文

Update-rc.d 命令的用法

添加启动项 将脚本放入/etc/init.d文件夹,并给予可执行权限 $ mv xx.sh /etc/init.d $ chmod +x /etc/init.d/xx.sh 设置开机自启 $ update-rc.d xx.sh defaults 删除开机自启 $ update-rc.d -f xx.sh remove……

阅读全文

V2Ray 流量转发配置

Caddy 配置 修改Caddyfile文件 yourdomian.com { tls youremail@gmail.com proxy /www localhost:8990 { websocket header_upstream -Origin } } Apache 配置一 编辑/usr/local/apache/conf/vhost目录下yourdomian.com.conf文件,将 443 端口配置修改为 <VirtualHost *:443> ServerAdmin youremail@gmail.com ServerName yourdomian.com ServerAlias yourdomian.com SSLEngine On RewriteEngine On RewriteCond %{HTTP:Upgrade} =websocket [NC] RewriteRule /(.*) ws://localhost:8990/$1 [P,L] RewriteCond %{HTTP:Upgrade} !=websocket [NC] RewriteRule /(.*) http://localhost:8990/$1 [P,L] SSLProxyEngine On Proxypass /www http://127.0.0.1:8990 ProxyPassReverse /www http://127.0.0.1:8990 SSLCertificateFile /etc/letsencrypt/live/yourdomian.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/yourdomian.com/privkey.pem </VirtualHost> 以上……

阅读全文

LAMP 禁止 IP 直接访问

针对开启了虚拟主机的 LAMP,修改conf/extra/httpd-vhosts.conf文件,添加以下内容: <virtualhost 1.1.1.1:80> #1.1.1.1为你的 IP ServerName 1.1.1.1 <Directory /> Order Allow,Deny Deny from all </Directory> </VirtualHost> 没有开启虚拟主机的 LAMP 直接修改httpd.conf文件。 需要注意的是,原.conf文件中的ServerName或Serve……

阅读全文

LAMP 设置反向代理

举例说明,将 1.test.com 和 2.test.com 两个域名通过反向代理指向 localhost:8080 端口 首先在 LAMP 添加任意域名,假设为 0.test.com 修改/usr/local/apache/conf/vhost目录下0.test.com.conf的配置文件,将文件修改为 <VirtualHost *:80> ServerAdmin mail@mail.com ServerName 0.test.com ServerAlias 1.test.com 2.test.com ProxyPreserveHost On ProxyPass / http://localhost:8088/ ProxyPassReverse / http://localhost:8088/ </VirtualHost> 即可。……

阅读全文

修复 LookingGlass 在 LAMP 上无法使用的问题

安装 LookingGlass 后发现 ping 和 mtr 等命令无法使用。发现是 PHP 的配置问题,解决方案如下: 编辑/usr/local/php目录下php.ini文件,找到 disable_functions = exec,system,dl,passthru,chown,shell_exec,popen,proc_open 将proc_open删掉,重启 Apache $ /etc/init.d/httpd restart 即可。……

阅读全文

LAMP IP 绑定域名

在 LAMP 添加的第一个网站根目录下.htaccess文件里添加: RewriteCond %{http_host} ^0.0.0.0 [NC] RewriteRule ^(.*)$ http://www.examples.com/$1 [R=301,L] 注意:0.0.0.0换成服务器的IP;www.examples.com更换为需要绑定的域名。……

阅读全文

Lighttpd 下 Typecho 伪静态设置

编辑lighttpd.conf文件,添加以下内容 #pseudo static url.rewrite = ( "^/(admin|usr)/(.*)" => "/$1/$2", "^/(.*).html$" => "/index.php/$1.html", "^/archives/(.*)" => "/index.php/archives/$1", "^/category/(.*)" => "/index.php/category/$1", "^/([0-9]+)/([0-9]+)/$" => "/index.php/$1/$2/", "^/tag/(.*)/$" => "/index.php/tag/$1", "^/search/(.*)/$" => "/index.php/search/$1", "^/(.*)page/(.*)" => "/index.php/$1page/$2", "^/(feed.*)" => "/index.php/$1", "^/action/(.*)" => "/index.php/action/$1", "^/(.*)comment" => "/index.php/$1/comment" ) 即可。……

阅读全文