首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在php 7.4上使用Ubuntu20.04和phpmyadmin如何建立非本地主机连接

在php 7.4上使用Ubuntu20.04和phpmyadmin如何建立非本地主机连接
EN

Ask Ubuntu用户
提问于 2021-02-28 21:38:15
回答 1查看 787关注 0票数 0

我使用的是无头cli服务器,因此本地主机上不会出现gui,SSH将不允许浏览器工作,而为远程显示添加xservice对于此服务器来说确实不值得。我阅读了一篇经过折旧的文章,您可以允许子网连接,但是使用此配置更新的.conf结构不再有效。

我需要知道的是在哪里找到phpmyadmin.conf,以及添加哪些行来允许我的子网从远程web浏览器连接。搜索我在其中找到的phpmyadmin.conf文件夹堆栈:

代码语言:javascript
复制
./etc/dbconfig-common/
./etc/apache2/conf-available/
./etc/apache2/conf-enabled/

我需要sudo来访问dbconfig- service中的一个,我看到了localhost,但是还不清楚这是否是服务自己访问的。在下面的文件夹中,我不知道localhost是唯一允许的连接,所以不知道在那里更改什么。

在正常桌面模式下,这不会是一个问题,但是当这是一个只有通过SSH的cli的服务器时,我不明白为什么没有一个明确的文档来解决这个问题,因为我确信没有人会添加一个桌面到一个无头服务器来完成这个任务,这违背了无头服务器的想法。

谢谢你的帮助,

请求来自Apache的000-default.conf的内容:

代码语言:javascript
复制
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf


#vim: syntax=apache ts=4 sw=4 sts=4 sr noet

或者默认。

代码语言:javascript
复制
location ~ \.php$ {
    include snippets/fastcgi-php.conf;

    # With php7.0-cgi alone:
    fastcgi_pass 127.0.0.1:9000;
    # With php7.0-fpm:
    fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}

不确定哪一个是活动的。在我发现的搜索结果中,这两个问题似乎都得到了讨论。

因此,我想我解决了网站的格式问题与您的要求。virtualhost部分没有注释掉,但是为了应用适当的格式化,我不得不注释掉它,以便它显示出来。

遗憾的是,没有一种方法可以像它在文件中显示的那样添加这一点。但没有人能礼貌地解释怎么做到的。

找不到服务器单元mariadb.service的结果。

试图清理重新安装我得到了这个

代码语言:javascript
复制
sudo apt autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
sh: 0: getcwd() failed: No such file or directory
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
sh: 0: getcwd() failed: No such file or directory
Setting up mysql-server-8.0 (8.0.23-0ubuntu0.20.04.1) ...
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
Renaming removed key_buffer and myisam-recover options (if present)
mysqld will log errors to /var/log/mysql/error.log
mysqld is running as pid 474814
AppArmor parser error for /etc/apparmor.d/usr.sbin.mysqld in /etc/apparmor.d/usr.sbin.mysqld at line 9: Could not open 'abstractions/mysql'
Failed to preset unit: File mysql.service: Link has been severed
/usr/bin/deb-systemd-helper: error: systemctl preset failed on mysql.service: No such file or directory
Failed to start mysql.service: Unit mysql.service not found.
invoke-rc.d: initscript mysql, action "start" failed.
Unit mysql.service could not be found.
dpkg: error processing package mysql-server-8.0 (--configure):
 installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 mysql-server-8.0
sh: 0: getcwd() failed: No such file or directory
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@panasonic:/var/run/mysqld#
代码语言:javascript
复制
root@panasonic:/var/run/mysqld# sudo apt install mariadb-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libevent-core-2.1-7 libevent-pthreads-2.1-7
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  galera-3 libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libmysqlclient21 libsnappy1v5
  libterm-readkey-perl mariadb-client-10.3 mariadb-client-core-10.3 mariadb-common
  mariadb-server-10.3 mariadb-server-core-10.3 socat
Suggested packages:
  libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl mailx mariadb-test tinyca
sh: 0: getcwd() failed: No such file or directory
The following packages will be REMOVED:
  mysql-client-8.0 mysql-client-core-8.0 mysql-server-8.0 mysql-server-core-8.0
The following NEW packages will be installed:
  galera-3 libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libmysqlclient21 libsnappy1v5
  libterm-readkey-perl mariadb-client-10.3 mariadb-client-core-10.3 mariadb-common mariadb-server
  mariadb-server-10.3 mariadb-server-core-10.3 socat
0 upgraded, 14 newly installed, 4 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/20.5 MB of archives.
After this operation, 19.8 MB disk space will be freed.
Do you want to continue? [Y/n] y
sh: 0: getcwd() failed: No such file or directory
sh: 0: getcwd() failed: No such file or directory
sh: 0: getcwd() failed: No such file or directory
Preconfiguring packages ...
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
(Reading database ... 134419 files and directories currently installed.)
Removing mysql-server-8.0 (8.0.23-0ubuntu0.20.04.1) ...
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
dpkg: error processing package mysql-server-8.0 (--remove):
 installed mysql-server-8.0 package pre-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
Failed to preset unit: File mysql.service: Link has been severed
/usr/bin/deb-systemd-helper: error: systemctl preset failed on mysql.service: No such file or directory
Failed to start mysql.service: Unit mysql.service not found.
invoke-rc.d: initscript mysql, action "start" failed.
Unit mysql.service could not be found.
dpkg: error while cleaning up:
 installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 mysql-server-8.0
Processing was halted because there were too many errors.
sh: 0: getcwd() failed: No such file or directory
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@panasonic:/var/run/mysqld#

但是删除尝试似乎没有要删除的mysql-server-8.0。删除mysql的结果:

代码语言:javascript
复制
root@panasonic:/var/run/mysqld# sudo apt remove mysql-server-8.0
Reading package lists... Done
Building dependency tree
Reading state information... Done
sh: 0: getcwd() failed: No such file or directory
The following packages will be REMOVED:
  mysql-server-8.0
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 1,481 kB disk space will be freed.
Do you want to continue? [Y/n] y
sh: 0: getcwd() failed: No such file or directory
(Reading database ... 134419 files and directories currently installed.)
Removing mysql-server-8.0 (8.0.23-0ubuntu0.20.04.1) ...
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
dpkg: error processing package mysql-server-8.0 (--remove):
 installed mysql-server-8.0 package pre-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
Failed to preset unit: File mysql.service: Link has been severed
/usr/bin/deb-systemd-helper: error: systemctl preset failed on mysql.service: No such file or directory
Failed to start mysql.service: Unit mysql.service not found.
invoke-rc.d: initscript mysql, action "start" failed.
Unit mysql.service could not be found.
dpkg: error while cleaning up:
 installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 mysql-server-8.0
Processing was halted because there were too many errors.
sh: 0: getcwd() failed: No such file or directory
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@panasonic:/var/run/mysqld#

这一切似乎都很矛盾。

EN

回答 1

Ask Ubuntu用户

回答已采纳

发布于 2021-03-01 02:56:03

基于这些注释,问题似乎是您使用root作为您的SQL数据库的登录名。出于许多安全原因,这是禁止的,因此您需要在MySQL (或MariaDB)中创建一个可供osTicket使用的用户帐户。

这就是你要做的:

  1. 在您的服务器上,连接到数据库: sudo
  2. 为osTicket创建一个数据库: mysql>创建数据库osticket默认CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  3. 为osTicket创建一个用户: mysql>创建用户'ostkt'@'localhost‘由’superSecretPassword!123‘标识为mysql_native_password;注意:确保将ostkt更改为您希望的东西。还可以将superSecretPassword!123更改为更好的东西。如果数据库位于与web服务器不同的系统上,则需要用百分比符号替换localhost。例如: mysql>通过‘superSecretPassword!123’创建与mysql_native_password标识的用户'ostkt'@'%‘;
  4. 授予新帐户对新数据库的完全访问权限:如果数据库位于与web服务器不同的服务器上,则mysql>将osticket.*上的所有权限授予'ostkt'@'localhost';注意:确保用%替换localhost
  5. 向osTicket配置文件提供凭据
  6. 继续设置osTicket

至于“没有人足够礼貌地解释如何做到这一点”,请理解AskUbuntu (和许多其他StackExchange站点)是由志愿者而不是员工提供动力的。当人们有空闲时间,有必要的知识和能力去帮助他们时,他们就会挑选问题。

希望有了这个答案,您可以继续安装osTicket。

票数 0
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1320114

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档