2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 23:18:43 +08:00

feat: 测试修改socket

This commit is contained in:
2026-01-17 21:42:28 +08:00
parent 50bb9af9bc
commit 4d2588e449
6 changed files with 13 additions and 13 deletions

View File

@@ -262,8 +262,8 @@ func (s *App) SetRootPassword(w http.ResponseWriter, r *http.Request) {
}
func (s *App) getSock() string {
if io.Exists("/tmp/mysql.sock") {
return "/tmp/mysql.sock"
if io.Exists("/run/mysql.sock") {
return "/run/mysql.sock"
}
if io.Exists(app.Root + "/server/mysql/config/my.cnf") {
config, _ := io.Read(app.Root + "/server/mysql/config/my.cnf")
@@ -282,5 +282,5 @@ func (s *App) getSock() string {
}
}
return "/tmp/mysql.sock"
return "/run/mysql.sock"
}

View File

@@ -285,7 +285,7 @@ func (r *backupRepo) createMySQL(to string, name string) error {
if err != nil {
return err
}
mysql, err := db.NewMySQL("root", rootPassword, "/tmp/mysql.sock", "unix")
mysql, err := db.NewMySQL("root", rootPassword, "/run/mysql.sock", "unix")
if err != nil {
return err
}
@@ -440,7 +440,7 @@ func (r *backupRepo) restoreMySQL(backup, target string) error {
if err != nil {
return err
}
mysql, err := db.NewMySQL("root", rootPassword, "/tmp/mysql.sock", "unix")
mysql, err := db.NewMySQL("root", rootPassword, "/run/mysql.sock", "unix")
if err != nil {
return err
}

View File

@@ -178,7 +178,7 @@ func (s *HomeService) CountInfo(w http.ResponseWriter, r *http.Request) {
var databaseCount int
if mysqlInstalled {
rootPassword, _ := s.settingRepo.Get(biz.SettingKeyMySQLRootPassword)
mysql, err := db.NewMySQL("root", rootPassword, "/tmp/mysql.sock", "unix")
mysql, err := db.NewMySQL("root", rootPassword, "/run/mysql.sock", "unix")
if err == nil {
defer mysql.Close()
databases, err := mysql.Databases()

View File

@@ -626,7 +626,7 @@ func (v *PHPVhost) PHP() uint {
}
// 从配置内容中提取版本号
// 格式: proxy:unix:/tmp/php-cgi-84.sock|fcgi://localhost/
// 格式: proxy:unix:/run/php-cgi-84.sock|fcgi://localhost/
idx := strings.Index(content, "php-cgi-")
if idx == -1 {
return 0
@@ -646,10 +646,10 @@ func (v *PHPVhost) SetPHP(version uint) error {
}
// 生成 PHP-FPM 配置
// sock 路径格式: unix:/tmp/php-cgi-84.sock
// sock 路径格式: unix:/run/php-cgi-84.sock
content := fmt.Sprintf(`# Auto-generated by AcePanel. DO NOT EDIT MANUALLY!
<FilesMatch \.php$>
SetHandler "proxy:unix:/tmp/php-cgi-%d.sock|fcgi://localhost/"
SetHandler "proxy:unix:/run/php-cgi-%d.sock|fcgi://localhost/"
</FilesMatch>
`, version)

View File

@@ -325,7 +325,7 @@ func (s *VhostTestSuite) TestPHPFilesMatchBlock() {
s.NoError(s.vhost.SetPHP(84))
content := s.vhost.Config("010-php.conf", "site")
s.Contains(content, "proxy:unix:/tmp/php-cgi-84.sock|fcgi://localhost/")
s.Contains(content, "proxy:unix:/run/php-cgi-84.sock|fcgi://localhost/")
}
func (s *VhostTestSuite) TestDefaultVhostConfIncludesServerD() {

View File

@@ -726,7 +726,7 @@ func (v *PHPVhost) PHP() uint {
}
// 从配置内容中提取版本号
// 格式: fastcgi_pass unix:/tmp/php-cgi-84.sock;
// 格式: fastcgi_pass unix:/run/php-cgi-84.sock;
idx := strings.Index(content, "php-cgi-")
if idx == -1 {
return 0
@@ -746,11 +746,11 @@ func (v *PHPVhost) SetPHP(version uint) error {
}
// 生成 PHP-FPM 配置
// sock 路径格式: unix:/tmp/php-cgi-84.sock
// sock 路径格式: unix:/run/php-cgi-84.sock
content := fmt.Sprintf(`# Auto-generated by AcePanel. DO NOT EDIT MANUALLY!
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi-%d.sock;
fastcgi_pass unix:/run/php-cgi-%d.sock;
fastcgi_index index.php;
include fastcgi.conf;
include pathinfo.conf;