應(yīng)用背景有公網(wǎng)需求,但是又不想去買(mǎi)又貴又低配置的服務(wù)器,然后方案就應(yīng)運(yùn)而生
frp/README_zh.md at dev · fatedier/frp (github.com)
在這里,
FRPC作為內(nèi)網(wǎng)穿透服務(wù),
PHP+MYSQL+APACHE2,作為網(wǎng)站搭建,具體細(xì)節(jié)不細(xì)講,
但是在我的/var/www/html下面
linaro@Hinlink:/var/www/html$ tree -L 1
.
├── 404.html
├── 筆記.txt
├── ask
├── base64
├── bg.png
├── chat
├── DownLoad
├── favicon.ico
├── H68K
├── index.html
├── on_publish.php
├── pac
├── probe.php
├── README.md
├── speedtest-x
├── tools
├── typecho
├── typecho_2023_5_1.sql
├── videos
├── WebShell.php
├── websocket.html
├── wordpress
├── www
└── xss
可以看到,有很多目錄,我想實(shí)現(xiàn) typecho.domain.com,這樣的三級(jí)域名的方式,訪問(wèn),
在FRPC.ini的配置里面
linaro@Hinlink:/var/www/html$ cat /etc/frp/frpc.ini
[common]
server_addr = FRPS服務(wù)器
server_port = 7000
token = 第三方token[HT2_PHP]
type = http
local_ip = 127.0.0.1
local_port = 80
remote_port = 80
#subdomain = www
custom_domains = *.domain.com?
?custom_domains 其中的值,帶上了*,通配符匹配
然后是去域名服務(wù)器配置域名解析
?然后,任意訪問(wèn)? www.domain.com或者222.domain.com,會(huì)發(fā)現(xiàn)得到的頁(yè)面都是一樣的
這個(gè)時(shí)候,需要配置apache
第一步開(kāi)啟地址重寫(xiě)
sudo a2enmod rewrite
第二步,修改配置文件
nano /etc/apache2/sites-available/000-default.conf
?
<VirtualHost *:80>
DocumentRoot /var/www/html
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(([-_a-zA-Z0-9])+)\.\w+\.\w+$ [NC]
RewriteRule ^(.*)$ /%1/$1 [L]
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ErrorDocument 404 "404 Not Found"
</VirtualHost>
第三步重啟Apache2
sudo systemctl restart apache2文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-857413.html
?自此,完成文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-857413.html
到了這里,關(guān)于FRPC+PHP+MYSQL+APACHE2=個(gè)人網(wǎng)站的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!