diff --git a/internal/apps/mysql/app.go b/internal/apps/mysql/app.go index 2ba48579..cc3c482b 100644 --- a/internal/apps/mysql/app.go +++ b/internal/apps/mysql/app.go @@ -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" } diff --git a/internal/data/backup.go b/internal/data/backup.go index f64fc82a..b03c477b 100644 --- a/internal/data/backup.go +++ b/internal/data/backup.go @@ -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 } diff --git a/internal/service/home.go b/internal/service/home.go index f55e25fd..f5c8fe8f 100644 --- a/internal/service/home.go +++ b/internal/service/home.go @@ -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() diff --git a/pkg/webserver/apache/vhost.go b/pkg/webserver/apache/vhost.go index 8caec770..105269da 100644 --- a/pkg/webserver/apache/vhost.go +++ b/pkg/webserver/apache/vhost.go @@ -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! - SetHandler "proxy:unix:/tmp/php-cgi-%d.sock|fcgi://localhost/" + SetHandler "proxy:unix:/run/php-cgi-%d.sock|fcgi://localhost/" `, version) diff --git a/pkg/webserver/apache/vhost_test.go b/pkg/webserver/apache/vhost_test.go index 069c2d46..80158cb5 100644 --- a/pkg/webserver/apache/vhost_test.go +++ b/pkg/webserver/apache/vhost_test.go @@ -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() { diff --git a/pkg/webserver/nginx/vhost.go b/pkg/webserver/nginx/vhost.go index 0fe9306c..a7f0718d 100644 --- a/pkg/webserver/nginx/vhost.go +++ b/pkg/webserver/nginx/vhost.go @@ -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;