AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题

问题[apache2](ubuntu)

Martin Hope
sanjihan
Asked: 2024-10-07 16:37:56 +0800 CST

php8.3-fpm 安装失败,安装后出现脚本错误

  • 7

我正在安装 redis,遇到 php8.3-fpm 安装错误。以下是相关的安装消息:

apt install redis-server
...
...
Setting up php8.3-fpm (8.3.6-0ubuntu0.24.04.2) ...
NOTICE: Not enabling PHP 8.3 FPM by default.
NOTICE: To enable PHP 8.3 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php8.3-fpm
NOTICE: You are seeing this message because you have apache2 package installed.
Job for php8.3-fpm.service failed because a timeout was exceeded.
See "systemctl status php8.3-fpm.service" and "journalctl -xeu php8.3-fpm.service" for details.
invoke-rc.d: initscript php8.3-fpm, action "restart" failed.
× php8.3-fpm.service - The PHP 8.3 FastCGI Process Manager
     Loaded: loaded (/usr/lib/systemd/system/php8.3-fpm.service; enabled; preset: enabled)
     Active: failed (Result: timeout) since Sun 2024-10-06 13:52:03 CEST; 16ms ago
       Docs: man:php-fpm8.3(8)
    Process: 285882 ExecStart=/usr/sbin/php-fpm8.3 --nodaemonize --fpm-config /etc/php/8.3/fpm/php-fpm.conf (code=exited, status=0/SUCCESS)
    Process: 285889 ExecStopPost=/usr/lib/php/php-fpm-socket-helper remove /run/php/php-fpm.sock /etc/php/8.3/fpm/pool.d/www.conf 83 (code=exited, status=0/SUCCESS)
   Main PID: 285882 (code=exited, status=0/SUCCESS)
        CPU: 90ms

Oct 06 13:50:33 Ubuntu-2404-noble-amd64-base systemd[1]: Starting php8.3-fpm.service - The PHP 8.3 FastCGI Process Manager...
Oct 06 13:52:03 Ubuntu-2404-noble-amd64-base systemd[1]: php8.3-fpm.service: start operation timed out. Terminating.
Oct 06 13:52:03 Ubuntu-2404-noble-amd64-base systemd[1]: php8.3-fpm.service: Failed with result 'timeout'.
Oct 06 13:52:03 Ubuntu-2404-noble-amd64-base systemd[1]: Failed to start php8.3-fpm.service - The PHP 8.3 FastCGI Process Manager.
dpkg: error processing package php8.3-fpm (--configure):
 installed php8.3-fpm package post-installation script subprocess returned error exit status 1
Setting up libjemalloc2:amd64 (5.3.0-2build1) ...
Setting up liblzf1:amd64 (3.6-4) ...
Setting up redis-tools (5:7.0.15-1build2) ...
Setting up redis-server (5:7.0.15-1build2) ...
Created symlink /etc/systemd/system/redis.service → /usr/lib/systemd/system/redis-server.service.
Created symlink /etc/systemd/system/multi-user.target.wants/redis-server.service → /usr/lib/systemd/system/redis-server.service.
Processing triggers for man-db (2.12.0-4build2) ...
Processing triggers for libc-bin (2.39-0ubuntu8.3) ...
Errors were encountered while processing:
 php8.3-fpm
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)

Systemctl 和 yournalctl 消息并不是特别具有描述性 - 只是说 php8.3-fpm 无法启动,结果为“超时”。

错误似乎出在dpkg处理上php8.3-fpm:installed php8.3-fpm package post-installation script subprocess returned error exit status 1

内容/var/lib/dpkg/info/php8.3-fpm.postinst:

#!/bin/sh

set -e

if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
    . /usr/share/apache2/apache2-maintscript-helper

    php_enable() {
        # Don't enable PHP FPM by default when Apache 2 is installed
        apache2_msg notice "NOTICE: Not enabling PHP 8.3 FPM by default."
        apache2_msg notice "NOTICE: To enable PHP 8.3 FPM in Apache2 do:"
        apache2_msg notice "NOTICE: a2enmod proxy_fcgi setenvif"
        apache2_msg notice "NOTICE: a2enconf php8.3-fpm"
        apache2_msg notice "NOTICE: You are seeing this message because you have apache2 package installed."
        return 1
    }
else
    php_enable() {
        # Don't enable PHP FPM by default when Apache 2 is not installed
        return 1
    }
fi

if [ "$1" = "triggered" ] && [ "$2" = "/etc/php/8.3/fpm/conf.d" ]; then
    invoke-rc.d php8.3-fpm restart
fi

CONFDIR=/etc/php/8.3/fpm/conf.d

if [ "$1" = "configure" ]; then
    phpini="/etc/php/8.3/fpm/php.ini"

    if [ "fpm" = "cli" ]; then
        ucf /usr/lib/php/8.3/php.ini-production.fpm $phpini
    else
        ucf /usr/lib/php/8.3/php.ini-production $phpini
    fi
    ucfr php8.3-fpm $phpini

    if [ -e /usr/lib/php/php-maintscript-helper ]; then
        . /usr/lib/php/php-maintscript-helper
        
        mods=$(phpquery -M -v 8.3)
        for mod in $mods; do
            php_invoke enmod 8.3 fpm $mod
        done
    fi

    if [ -n "$2" ] && dpkg --compare-versions "$2" lt "7.0.3-2~"; then
        rm -f /etc/php/8.3/fpm/conf.d/20-opcache.ini;
    fi      
fi

# Automatically added by dh_apache2/UNDECLARED
if php_enable; then
        if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
                . /usr/share/apache2/apache2-maintscript-helper
                for conf in php8.3-fpm  ; do
                        apache2_invoke enconf $conf  || exit 1
                done
        fi
fi
# End automatically added section
# Automatically added by dh_systemd_enable/13.14.1ubuntu5
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
        # The following line should be removed in trixie or trixie+1
        deb-systemd-helper unmask 'php8.3-fpm.service' >/dev/null || true

        # was-enabled defaults to true, so new installations run enable.
        if deb-systemd-helper --quiet was-enabled 'php8.3-fpm.service'; then
                # Enables the unit on first installation, creates new
                # symlinks on upgrades if the unit file has changed.
                deb-systemd-helper enable 'php8.3-fpm.service' >/dev/null || true
        else
                # Update the statefile to add new symlinks (if any), which need to be
                # cleaned up on purge. Also remove old symlinks.
                deb-systemd-helper update-state 'php8.3-fpm.service' >/dev/null || true
        fi
fi
# End automatically added section
# Automatically added by dh_installinit/13.14.1ubuntu5
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
        if [ -x "$(command -v systemd-tmpfiles)" ]; then
                systemd-tmpfiles ${DPKG_ROOT:+--root="$DPKG_ROOT"} --create php8.3-fpm.conf || true
        fi
fi
# End automatically added section
# Automatically added by dh_installdeb/13.14.1ubuntu5
dpkg-maintscript-helper rm_conffile /etc/init/php8.3-fpm.conf 7.4.3-4\~ php8.3-fpm -- "$@"
# End automatically added section
# Automatically added by dh_installinit/13.14.1ubuntu5
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
        if [ -z "${DPKG_ROOT:-}" ] && [ -x "/etc/init.d/php8.3-fpm" ]; then
                update-rc.d php8.3-fpm defaults >/dev/null
                if [ -n "$2" ]; then
                        _dh_action=restart
                else
                        _dh_action=start
                fi
                invoke-rc.d php8.3-fpm $_dh_action || exit 1
        fi
fi
# End automatically added section


exit 0

不熟悉 dpkg 的功能,但exit 1会出现在两个位置。第一个出现在读取 apache conf 文件时。我已删除 apache2,因此这个不再会触发。第二个只是表示启动/重启失败。

有什么提示可以说明问题所在吗?这似乎超出了我的技能水平。

附加信息:运行systemctl status php8.3-fpm.service回报

× php8.3-fpm.service - The PHP 8.3 FastCGI Process Manager
     Loaded: loaded (/usr/lib/systemd/system/php8.3-fpm.service; enabled; preset: enabled)
     Active: failed (Result: timeout) since Mon 2024-10-07 11:34:21 CEST; 1min 33s ago
       Docs: man:php-fpm8.3(8)
    Process: 334032 ExecStart=/usr/sbin/php-fpm8.3 --nodaemonize --fpm-config /etc/php/8.3/fpm/php-fpm.conf (code=exited, status=0/SUCCESS)
    Process: 334035 ExecStopPost=/usr/lib/php/php-fpm-socket-helper remove /run/php/php-fpm.sock /etc/php/8.3/fpm/pool.d/www.conf 83 (code=exited, status=0/SUCCESS)
   Main PID: 334032 (code=exited, status=0/SUCCESS)
        CPU: 98ms

Oct 07 11:32:51 Ubuntu-2404-noble-amd64-base systemd[1]: Starting php8.3-fpm.service - The PHP 8.3 FastCGI Process Manager...
Oct 07 11:34:21 Ubuntu-2404-noble-amd64-base systemd[1]: php8.3-fpm.service: start operation timed out. Terminating.
Oct 07 11:34:21 Ubuntu-2404-noble-amd64-base systemd[1]: php8.3-fpm.service: Failed with result 'timeout'.
Oct 07 11:34:21 Ubuntu-2404-noble-amd64-base systemd[1]: Failed to start php8.3-fpm.service - The PHP 8.3 FastCGI Process Manager.

此外,手动启动服务并/usr/sbin/php-fpm8.3 --nodaemonize --fpm-config /etc/php/8.3/fpm/php-fpm.conf返回

NOTICE: fpm is running, pid 334206
NOTICE: ready to handle connections
NOTICE: systemd monitor interval set to 10000ms
... no more messages

表示 fpm 已成功启动,但 systemd 可能存在问题?我是否遇到了不匹配的 PID 编号?

apache2
  • 1 个回答
  • 105 Views
Martin Hope
anjanesh
Asked: 2024-06-12 02:18:26 +0800 CST

密码仅保护目录列表,而不保护文件本身

  • 9

我有/home/sammy/public_html/cache/.htaccess

Options +Indexes

<Files *>
AuthType Basic
AuthName "Authentication Required"
AuthUserFile /home/sammy/public_html/cache/.htpasswd
Require valid-user
</Files>

但我只希望目录列表受密码保护 - 而不是文件本身。

问题是,当我去时,example.test/cache/somefile.pdf它会提示输入用户名和密码。

apache2
  • 1 个回答
  • 314 Views
Martin Hope
John
Asked: 2024-06-04 03:08:11 +0800 CST

CGI 脚本在本地运行,但在服务器上失败并出现 404 错误

  • 5

我在 Apache Web 服务器上运行 CGI 脚本时遇到问题。该脚本在我的本地计算机上运行正常,但在服务器上失败并出现 404 错误,表明 URL 不存在。我的本地计算机和服务器都运行相同版本的 Ubuntu 和 Apache。服务器上的错误日志报告 Apache 正在默认位置(即 )而/usr/lib/cgi-bin/不是预期位置 中查找 CGI 脚本/var/www/mysite.com/cgi-bin/。同样,它在我的本地计算机上运行良好。

[Mon Jun 03 20:17:19.522377 2024] [cgi:error] [pid 78594] [client xx.xxx.xx.xxx:55973] AH02811: script not found or unable to stat: /usr/lib/cgi-bin/hello.py

在提供的配置示例中,mysite.com 是网站真实 URL 的占位符。

以下是我的设置细节:

  • Ubuntu 版本:24.04 LTS
  • Apache 版本:Apache/2.4.58(Ubuntu)
  • CGI 脚本路径: /var/www/mysite.com/cgi-bin/hello.py
  • 网址: https://mysite.com/cgi-bin/hello.py

配置步骤:

  1. 站点配置:

    <VirtualHost *:80>
        ServerName mysite.com
        ServerAlias www.mysite.com
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/mysite.com
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    
        ScriptAlias /cgi-bin/ /var/www/mysite.com/cgi-bin/
    
        <Directory "/var/www/mysite.com/cgi-bin">
            Options +ExecCGI
            AddHandler cgi-script .py
            Require all granted
        </Directory>
    </VirtualHost>
    
  2. CGI脚本(hello.py):

    #!/usr/bin/env python3
    
    print("Content-Type: text/html")
    print()
    print("<html><body><h1>Test CGI Script for mysite.com</h1></body></html>")
    
  3. 权限:

    chmod 755 /var/www/mysite.com/cgi-bin/hello.py
    
  4. 启用 Apache 模块:

    • 程序网关
  5. Apache 配置命令:

    sudo a2enmod cgi
    sudo a2ensite mysite.com.conf
    sudo systemctl restart apache2
    

问题:

当我访问https://mysite.com/cgi-bin/hello.py我的服务器时,我收到 404 错误,指出 URL 不存在。但是,同样的设置在我本地机器上运行良好。

观察结果:

该脚本在终端上运行良好,即 python3 /var/www/mysite.com/cgi-bin/hello.py按预期运行。

故障排除步骤:

  • 已验证 CGI 脚本是否存在于服务器上的正确路径中。
  • 检查 CGI 脚本和目录的权限。
  • 确保 CGI 模块已启用。
  • 比较本地机器和服务器之间的配置。

我不知道为什么这在服务器上不起作用,但在本地却起作用。任何关于导致此问题的原因的见解或建议都将不胜感激!

apache2
  • 1 个回答
  • 45 Views
Martin Hope
onecopyman
Asked: 2024-01-26 01:33:30 +0800 CST

Ubuntu 中 JS 文件的路径

  • 6

这可能可能重复,但没有像我一样找到确切的问题。

我有一个 Ubuntu 服务器,它在 Apache 上运行 Flask,问题是我有下一个路径:

 /var/www/someapp/video.mp4. And app.py file inside 
 /var/www/someapp/app.py and inside of this file I need to access

到这个video.mp4文件。我尝试通过以下方式访问它:

'/var/www/someapp/video.mp4' or '/video.mp4' or './video.mp4' 

但没有任何作用。浏览器显示

404 或 NS_BINDING_ABORTED。

我猜想访问此文件有问题,但不确定。
有什么建议为什么这不起作用以及如何修复它吗?

apache2
  • 1 个回答
  • 42 Views
Martin Hope
EnzoR
Asked: 2024-01-16 00:01:41 +0800 CST

Apache v2.4 通过端口 443 提供 HTTP 服务

  • 6

我在 Ubuntu 20.04 上遇到了这个问题。

它看起来很像许多类似的东西,但经过几个小时的尝试,结果证明它不是通常的东西。

我曾经certbot --apache将 HTTPS 添加到我服务器上的一个工作网站。我要求自动重定向到 HTTPS。一切显然都顺利。我还运行a2enmod ssl; a2nsite default-ssl.conf启用 SSL 模块并重新启动 apache2。

在日志中似乎读取了证书:

[ssl:info] [pid 4187632] AH02568: Certificate and private key mysite.com:443:0 configured from /etc/letsencrypt/live/mysite.com/fullchain.pem and /etc/letsencrypt/live/mysite.com/privkey.pem

我也发现了这个,但找不到足够的文档:

 [headers:debug] [pid 4188047] mod_headers.c(899): AH01503: headers: ap_headers_error_filter()

最终发生的情况是,apache2 正在侦听端口 443,但一旦发生重定向,就会通过该端口提供 HTTP 服务。当然,浏览器无法工作并会抛出如下错误:

This site can’t provide a secure connection
mysite.com sent an invalid response.
ERR_SSL_PROTOCOL_ERROR

没有别的。

从另一台服务器我可以做这两个简单的测试:

$ nmap -A -Pn -p 443 mysite.com.
Nmap scan report for mysite.com. (1.2.3.4)
Host is up (0.044s latency).
Other addresses for mysite.com. (not scanned): 1234:1234:123:1234::
rDNS record for 1.2.3.4: host1.hosting.net

PORT    STATE SERVICE VERSION
443/tcp open  http    Apache httpd 2.4.41
|_http-server-header: Apache/2.4.41 (Ubuntu)
|_http-title: Did not follow redirect to https://mysite.com/
Service Info: Host: mysite.com

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 7.64 seconds

和

$ wget -v -v -v https://mysite.com/
--2024-01-15 16:42:45--  https://mysite.com/
Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt'
Resolving mysite.com (mysite.com)... 1.2.3.4, 1234:1234:123:1234::
Connecting to mysite.com (mysite.com)|1.2.3.4|:443... connected.
GnuTLS: An unexpected TLS packet was received.
Unable to establish SSL connection.

这些证实了我的诊断(通过端口 443 的 HTTP),并且没有防火墙阻止任何内容。

有什么提示吗?

我的(主要)配置位如下。

所有其他文件(000-default.conf和default-ssl.conf)都是 Ubuntu 20.04 安装的默认文件。

ports.conf:

# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

Listen 80

<IfModule ssl_module>
        Listen 443
</IfModule>

<IfModule mod_gnutls.c>
        Listen 443
</IfModule>

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

mysite.conf

<VirtualHost _default_:80>
  ServerName  mysite.com
  ServerAlias  www.mysite.com
  ServerAdmin [email protected]
  DocumentRoot /home/fe/public_html

  <Directory />
    Options FollowSymLinks ExecCGI
    AllowOverride All
    AuthType Basic
    AuthName "Credentials, please"
    AuthUserFile /home/fe/.htpasswd
    Require valid-user
  </Directory>

  ScriptAlias /x/ /home/fe/cgi/
  <Directory "/home/fe/cgi">
    Options ExecCGI
    SetHandler cgi-script
    Require all granted
  </Directory>

  ErrorLog ${APACHE_LOG_DIR}/mysite-error.log
  LogLevel debug
  CustomLog ${APACHE_LOG_DIR}/mysite-access.log combined
  <FilesMatch "\.(cgi|shtml|phtml|php)$">
  </FilesMatch>
  <Directory /usr/lib/cgi-bin>
  </Directory>
  BrowserMatch "MSIE [2-6]" \
    nokeepalive ssl-unclean-shutdown \
    downgrade-1.0 force-response-1.0
  # MSIE 7 and newer should be able to use keepalive
  BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
RewriteEngine on
RewriteCond %{SERVER_NAME} =site.mysite.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

最后三行已由 添加certbot。

mysite-le-ssl.conf

<IfModule mod_ssl.c>
 <VirtualHost _default_:443>
  ServerName  mysite.com
  ServerAlias  www.mysite.com
  ServerAdmin [email protected]
  DocumentRoot /home/fe/public_html

  <Directory />
    Options FollowSymLinks ExecCGI
    AllowOverride All
    AuthType Basic
    AuthName "Credentials, please"
    AuthUserFile /home/fe/.htpasswd
    Require valid-user
  </Directory>

  ScriptAlias /x/ /home/fe/cgi/
  <Directory "/home/fe/cgi">
    Options ExecCGI
    SetHandler cgi-script
    Require all granted
  </Directory>

  ErrorLog ${APACHE_LOG_DIR}/mysite-error.log
  LogLevel debug
  CustomLog ${APACHE_LOG_DIR}/mysite-access.log combined
  <FilesMatch "\.(cgi|shtml|phtml|php)$">
  </FilesMatch>
  <Directory /usr/lib/cgi-bin>
  </Directory>
  BrowserMatch "MSIE [2-6]" \
    nokeepalive ssl-unclean-shutdown \
    downgrade-1.0 force-response-1.0
  # MSIE 7 and newer should be able to use keepalive
  BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown

  SSLCertificateFile /etc/letsencrypt/live/mysite.com/fullchain.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/mysite.com/privkey.pem
  Include /etc/letsencrypt/options-ssl-apache.conf
  </VirtualHost>
</IfModule>
apache2
  • 1 个回答
  • 44 Views
Martin Hope
Dean Debrio
Asked: 2023-11-27 15:34:14 +0800 CST

为什么我在使用 nginx 时看到 Apache2 默认页面

  • 6

这是我第一次使用 Ubuntu 设置虚拟服务器,我对 Apache2 有一些疑问。

当我打开虚拟服务器时,它以lightppd. 因为(我认为)我过去使用 XAMPP 界面更熟悉 Apache 设置,所以我卸载了它并安装了 Apache。现在已经使用 Apache2 两周了,我的网站(连接到上述 VPS)不断显示 Apache 成功设置页面。我已经尝试了 Ubuntu stackExchange 和其他论坛中的所有解决方案,但结果仍然保持不变。所以从今天开始,我卸载了 Apache 并尝试使用其他服务器(例如 NGINX)。

但是在我卸载它之后,该页面仍然存在,就好像我对它所做的任何事情都不起作用一样。我重新启动了我的 VPS,重新启动了系统,删除了与 Apache 相关的所有内容,但该页面仍然显示在我的网站中。有谁知道我该怎么办以及在哪里寻找问题的根源?

Ubuntu版本是22.04.3 LTS,

Apache 正在工作页面: 在此输入图像描述

netstat -tulp不显示任何 Apache 服务: 在此输入图像描述

我看过这个帮助页面 Cannot shutdown apache2 on 16.04 LTS但 Apache isworking 页面仍然存在。感谢您的帮助。

删除 apache 似乎还应该包括/var/www目录,但由于我也有 nginx,看起来我们可以同时拥有一个/var/www目录

在该/var/www目录中,我看到两个文件夹:一个是命名文件html夹,另一个是我自己的个人网站目录,假设它是myOwnBlog.com. 目录中/var/www/html有两个文件,分别名为test.html和index.nginx-debian.html

html
|-- index.nginx-debian.html
`-- test.html

我们可以忽略/var/www/myOwnBlog.com它,因为它是空的。即使我在此处添加内容,该内容也不会出现,而是显示 Apache 成功消息。

sudo service apache2 status显示:

sudo service apache2 status
Unit apache2.service could not be found.

所以可以验证apache2已经完全卸载了。

sudo service nginx status显示:

nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: en>
     Active: active (running) since Tue 2023-11-28 13:25:43 UTC; 1h 15min ago
       Docs: man:nginx(8)
    Process: 419 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process o>
    Process: 519 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=>
   Main PID: 538 (nginx)
      Tasks: 3 (limit: 9553)
     Memory: 10.6M
        CPU: 114ms
     CGroup: /system.slice/nginx.service
             ├─538 "nginx: master process /usr/sbin/nginx -g daemon on; master_pro>
             ├─539 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" >
             └─540 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" >

可以验证nginx确实还在运行。

编辑 1: 添加 sotirov 要求的详细信息:

目录中有一个sites-available /etc/nginx/,内容确实符合要求:

tree sites-available
sites-available
`-- default

index.nginx-debian.html正如预期的那样,其内容是一个欢迎页面,内容nginx为“Welcome to Nginx!” 等等。

这是内容,我认为它应该出现,而不是 Apache 成功页面:

  GNU nano 6.2               index.nginx-debian.html                         <!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

编辑 2: 尝试有关删除 Apache 的过时方法的 sotirov 提示,

我无法粘贴结果,因为 ssh 一段时间后重新启动了它的会话。但它找到了这些软件包并推荐我sudo apt autoremove:

The following packages will be REMOVED:
  apache2-bin apache2-data apache2-utils libapr1 libaprutil1
  libaprutil1-dbd-sqlite3 libaprutil1-ldap
0 upgraded, 0 newly installed, 7 to remove and 91 not upgraded.
After this operation, 7,160 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 101786 files and directories currently installed.)
Removing apache2-bin (2.4.52-1ubuntu4.6) ...
Removing apache2-data (2.4.52-1ubuntu4.6) ...
Removing apache2-utils (2.4.52-1ubuntu4.6) ...
Removing libaprutil1-dbd-sqlite3:amd64 (1.6.1-5ubuntu4.22.04.2) ...
Removing libaprutil1-ldap:amd64 (1.6.1-5ubuntu4.22.04.2) ...
Removing libaprutil1:amd64 (1.6.1-5ubuntu4.22.04.2) ...
Removing libapr1:amd64 (1.7.0-8ubuntu0.22.04.1) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.4) ...
apache2
  • 1 个回答
  • 145 Views
Martin Hope
Robert Zelník
Asked: 2023-11-11 03:13:45 +0800 CST

无法在 Ubuntu 23.10 上使用 MariaDB 激活 php-mysql

  • 6

我将 Ubuntu 升级到版本 23.10。这是 PHP 8.2 附带的。我从标准 Ubuntu 存储库安装了 MariaDB 和 php-mysql 扩展。

sudo apt install php libapache2-mod-php php-mysql mariadb-server

MariaDB 通过 CLI 客户端运行良好,但 PHP 不与数据库通信。

我的本地 WordPress 安装返回此错误消息:

Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

Please check that the mysqli PHP extension is installed and enabled.

我找到了这个信息:
PHP 8.2: MySQLi can not be more be generated with libmysqli
https://php.watch/versions/8.2/mysqli-libmysql-no-longer-supported

这可能是原因吗?有没有办法在Ubuntu的PHP 8.2中激活MySQL Native Driver?

更新:通过从ppa:ondrej/php降级到 PHP 8.1 暂时解决。

apache2
  • 1 个回答
  • 89 Views
Martin Hope
Hawk007
Asked: 2023-09-24 23:44:49 +0800 CST

如何在 Ubuntu 22.04 上为 php 5.6 启用 mcrypt

  • 6

我正在使用 Ubuntu 22.04 和一个需要 PHP 5.6 的网站。但在安装网站脚本时出现错误:

mcrypt is not enabled on your web hosting account

为了安装mcrypt,我使用了:

sudo apt install php5.6-mcrypt 

但在 php 信息中它没有启用。我尝试过phpenmod mcrypt,并且收到类似以下的警告:

WARNING: Module mcrypt ini file doesn't exist under /etc/php/8.2/mods-available
WARNING: Module mcrypt ini file doesn't exist under /etc/php/8.0/mods-available

我尚未在这些版本的 PHP 上安装 mcrypt,因此不需要它们。

然而,似乎没有什么能让 php5.6 mcrypt 启动。

我尝试将下面的行添加到其中,php.ini但这又不能解决问题。

extension=mcrypt.so
extension=php_mcrypt.dll

关于如何让 mcrypt 适用于 php5.6 的任何想法。

我正在使用php5.6-fpm并将其添加到虚拟主机中,以便为 sdomain 加载 php5.6。

附加信息:

inkspot@vps:~$ sudo apt install php5.6-mcrypt
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
php5.6-mcrypt is already the newest version (5.6.40-68+ubuntu22.04.1+deb.sury.or g+1).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

inkspot@vps:~$ sudo a2enmod proxy_fcgi
Considering dependency proxy for proxy_fcgi:
Module proxy already enabled
Module proxy_fcgi already enabled

inkspot@vps:~$ sudo a2enmod setenvif
Module setenvif already enabled

inkspot@vps:~$ sudo a2enconf php5.6-fpm
Enabling conf php5.6-fpm.
To activate the new configuration, you need to run:
  systemctl reload apache2
  
inkspot@vps:~$ sudo phpenmod mcrypt
WARNING: Module mcrypt ini file doesn't exist under /etc/php/8.2/mods-available
WARNING: Module mcrypt ini file doesn't exist under /etc/php/8.2/mods-available
WARNING: Module mcrypt ini file doesn't exist under /etc/php/8.2/mods-available
WARNING: Module mcrypt ini file doesn't exist under /etc/php/8.1/mods-available
WARNING: Module mcrypt ini file doesn't exist under /etc/php/8.1/mods-available
WARNING: Module mcrypt ini file doesn't exist under /etc/php/8.1/mods-available

inkspot@vps:~$ sudo service apache2 restart
inkspot@vps:~$ sudo service php5.6-fpm restart
inkspot@vps:~$

这是以下结果: sudo apache2ctl -M

Loaded Modules:
 core_module (static)
 so_module (static)
 watchdog_module (static)
 http_module (static)
 log_config_module (static)
 logio_module (static)
 version_module (static)
 unixd_module (static)
 access_compat_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 expires_module (shared)
 fcgid_module (shared)
 filter_module (shared)
 mime_module (shared)
 mpm_prefork_module (shared)
 negotiation_module (shared)
 php_module (shared)
 proxy_module (shared)
 proxy_fcgi_module (shared)
 reqtimeout_module (shared)
 rewrite_module (shared)
 security2_module (shared)
 setenvif_module (shared)
 socache_shmcb_module (shared)
 ssl_module (shared)
 status_module (shared)
 unique_id_module (shared)

apache2
  • 1 个回答
  • 184 Views
Martin Hope
Grabowsky
Asked: 2023-05-25 16:07:34 +0800 CST

Ubuntu 核心 22 上的 Web 服务器

  • 5

我开始为 ubuntu 核心开发。我想在 ubuntu 核心上托管我的 php web 应用程序。问题是它是基于 snap 的操作系统,我无法安装 apache2 和托管我的网页所需的其他软件包。你能提供托管 php web 应用程序的快照吗?或者有什么方法可以在 Ubuntu 核心上安装 apache2?

apache2
  • 1 个回答
  • 42 Views
Martin Hope
GTP95
Asked: 2023-01-22 15:53:02 +0800 CST

无法让 Apache2 在 Ubuntu 服务器 20.04 上使用 PHP8.1

  • 5

我有一个 Ubuntu 服务器 20.04 安装,其中包括使用 Apache 作为 Web 服务器运行裸机 Nextcloud 实例。我安装了多个 PHP 版本,但到目前为止 Apache 使用的是 PHP 7.4。由于 Nextcloud 弃用了它,我试图迁移到 PHP 8.1(新的推荐版本,仍然不支持 PHP 8.2)。我尝试遵循许多关于如何执行此操作的指南,所有这些基本上都归结为安装 PHP 8.1 和所需的模块,用于a2dismod php7.4禁用旧的 PHP 版本,启用新版本a2enmod php8.1并使用systemctl restart apache2. 这是我关注的最后一个:链接. 但尽管如此,Apache 仍继续使用 PHP 7.4。如果我尝试卸载 PHP 7.4,我的 Nextcloud 安装就会中断(我收到 503 错误)。我尝试了一些细微的变化,但总是失败并最终恢复了我在尝试之前创建的 lvm 快照。但我仍然没有恢复上次尝试的快照,在这里我完成了链接指南中的所有步骤并且我没有卸载 PHP 7.4,所以我的 Nextcloud 仍在工作但使用了错误的版本。我可以检查什么或尝试解决这个问题?谢谢您的帮助,

GTP

apache2
  • 1 个回答
  • 76 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve