2233466866 / lnmp Goto Github PK
View Code? Open in Web Editor NEWDocker Linux+Nignx+MySQL+PHP+Node.js+Redis
Home Page: https://hub.docker.com/r/2233466866/lnmp
License: MIT License
Docker Linux+Nignx+MySQL+PHP+Node.js+Redis
Home Page: https://hub.docker.com/r/2233466866/lnmp
License: MIT License
请问可以更新一下Git版本为最新吗
php服务重载配置报错:
systemd[1]: Reloading Php7 service..
kill[171]: kill: cannot find process "`cat"
kill[171]: kill: cannot find process "/usr/local/php7/var/run/php-fpm.pid`"
systemd[1]: php7.service: control process exited, code=exited status=1
systemd[1]: Reload failed for Php7 service..
分析:PIDFile配置的问题
解决:
修改/etc/systemd/system/php7.service内容为:
[Unit]
Description=Php7 service.
After=default.target network.target syslog.target
[Service]
User=root
Group=root
Type=forking
PIDFile=/usr/local/php7/var/run/php-fpm.pid
ExecStart=/usr/local/php7/sbin/php-fpm
ExecReload=/bin/kill -USR2 $MAINPID
ExecStop=/bin/kill -INT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
php5和php8也应该修改,均完成之后,重载服务配置:
systemctl daemon-reload
先写结论:里面两个版本的php-fpm都有问题,最后重新从官网下载7.4版本的,编译安装之后才正常
过程
1.在nginx.conf添加了一行,允许创建多个虚拟主机
include /usr/local/nginx/conf/vhost/*.conf;
2.创建/usr/local/nginx/conf/vhost目录并添加虚拟主机配置如下
`server {
listen 80;
server_name aa.xxx.cn bb.xxx.cn;
root /www/aa.xxx.cn/public;
index index.html index.php;
location ~ /.svn/ {
deny all;
}
location / {
if ( !-e $request_filename ) {
rewrite ^/JXE6A5t4jy.php/(.*)$ /JXE6A5t4jy.php?s=/$1 last;
rewrite ^/(.*)$ /index.php?s=$1 last;
break;
}
}
location /favicon.ico {
log_not_found off;
access_log off;
}
location /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME /www/aa.xxx.cn/public$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED /www/aa.xxx.cn/public$fastcgi_path_info;
include fastcgi_params;
}
access_log logs/aa.xxx.cn_access.log main;
error_log logs/aa.xxx.cn_error.log;
}
`
3.创建/www/aa.xxx.cn/目录
chown -R www:www /www/aa.xxx.cn
chmod -R 0755 /www/aa.xxx.cn
4.访问html文件正常,访问任何php文件都提示PHP Warning: Unknown: failed to open stream
检查了,访问的目录和文件都存在的,owner都是www,权限无论全局0755还是0777都无效,一直提示这个
5.strace跟踪进程返回内容如下:
{sa_family=AF_INET, sin_port=htons(43606), sin_addr=inet_addr("127.0.0.1")}, [112->16]) = 3 times({tms_utime=0, tms_stime=0, tms_cutime=0, tms_cstime=0}) = 508452285 poll([{fd=3, events=POLLIN}], 1, 5000) = 1 ([{fd=3, revents=POLLIN}]) read(3, "\1\1\0\1\0\10\0\0", 8) = 8 read(3, "\0\1\0\0\0\0\0\0", 8) = 8 read(3, "\1\4\0\1\4\206\2\0", 8) = 8 read(3, "\17&SCRIPT_FILENAME/www/aa.xxx.cn/public/index.php\t\0PATH_INFO\17\34PATH_TRANSLATED/www/aa.xxx.cn/public\f\0QUERY_STRING\16\3REQUEST_METHODGET\f\0CONTENT_TYPE\16\0CONTENT_LENGTH\v\nSCRIPT_NAME/index.php\v\nREQUEST_URI/index.php\f\nDOCUMENT_URI/index.php\r\34DOCUMENT_ROOT/www/aa.xxx.cn/public\17\10SERVER_PROTOCOLHTTP/1.1\16\4REQUEST_SCHEMEhttp\21\7GATEWAY_INTERFACECGI/1.1\17\fSERVER_SOFTWAREnginx/1.19.4\v\nREMOTE_ADDR172.17.0.1\v\5REMOTE_PORT60310\v\nSERVER_ADDR172.17.0.3\v\2SERVER_PORT80\v\20SERVER_NAMEaa.xxx.cn\17\3REDIRECT_STATUS200\t\20HTTP_HOSTdiag4.golodev.cn\17\nHTTP_CONNECTIONkeep-alive\22\tHTTP_CACHE_CONTROLmax-age=0\36\1HTTP_UPGRADE_INSECURE_REQUESTS1\17sHTTP_USER_AGENTMozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36\v\200\0\0\207HTTP_ACCEPTtext/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\24\rHTTP_ACCEPT_ENCODINGgzip, deflate\24#HTTP_ACCEPT_LANGUAGEzh-CN,zh;q=0.9,en-US;q=0.8,en"..., 1160) = 1160 read(3, "\1\4\0\1\0\0\0\0", 8) = 8 setitimer(ITIMER_PROF, {it_interval={tv_sec=0, tv_usec=0}, it_value={tv_sec=60, tv_usec=0}}, NULL) = 0 rt_sigaction(SIGPROF, {sa_handler=0x71ded0, sa_mask=[PROF], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f5d08320400}, {sa_handler=0x71ded0, sa_mask=[PROF], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f5d08320400}, 8) = 0 rt_sigprocmask(SIG_UNBLOCK, [PROF], NULL, 8) = 0 lstat("/www/aa.xxx.cn/public", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 lstat("/www/aa.xxx.cn", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 lstat("/www", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0 open("/www/aa.xxx.cn/public", O_RDONLY) = 4 fstat(4, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 close(4) = 0 write(2, "NOTICE: PHP message: PHP Warning: Unknown: failed to open stream: Success in Unknown on line 0\n", 96) = 96 write(2, "ERROR: Unable to open primary script: /www/aa.xxx.cn/public (Success)\n", 77) = 77 times({tms_utime=0, tms_stime=0, tms_cutime=0, tms_cstime=0}) = 508452286 setitimer(ITIMER_PROF, {it_interval={tv_sec=0, tv_usec=0}, it_value={tv_sec=0, tv_usec=0}}, NULL) = 0 write(3, "\1\7\0\1\0\236\2\0PHP message: PHP Warning: Unknown: failed to open stream: Success in Unknown on line 0\nUnable to open primary script: /www/aa.xxx.cn/public (Success)\n\0\0\1\6\0\1\0Z\6\0Status: 404 Not Found\r\nContent-type: text/html; charset=UTF-8\r\n\r\nNo input file specified.\n\0\0\0\0\0\0\1\3\0\1\0\10\0\0\0\0\0\0\0\0\0\0", 288) = 288 shutdown(3, SHUT_WR) = 0 recvfrom(3, "\1\5\0\1\0\0\0\0", 8, 0, NULL, NULL) = 8 recvfrom(3, "", 8, 0, NULL, NULL) = 0 close(3) = 0 setitimer(ITIMER_PROF, {it_interval={tv_sec=0, tv_usec=0}, it_value={tv_sec=0, tv_usec=0}}, NULL) = 0 accept(0,
6.访问html文件正常php文件报错已经确定了是php这边的问题,但是具体原因无法定位,这个报错信息和网上所有的案例都不通过
7.从网上从新下载php7.4然后编译安装,监听端口9004,修改nginx里面fpm的监听端口,然后重启nginx,再次访问同样地址,就正常了
[root@79ae4d783f8a mysql]# systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: deactivating (stop-sigterm) (Result: exit-code)
Process: 2896 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=1/FAILURE)
Process: 2872 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
CGroup: /docker/79ae4d783f8aa83a791c2b30d96fa721867dece0a06bd1ce56fc23306a5c8950/system.slice/mysqld.service
└─2898 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
Mar 23 22:05:30 79ae4d783f8a systemd[1]: Starting MySQL Server...
Mar 23 22:05:30 79ae4d783f8a mysqld_pre_systemd[2872]: 2022-03-23T14:05:30.936946Z 0 [Warning] Ignoring user change to 'mysql' because the user was set to 'www' earlier on the command line
Mar 23 22:05:30 79ae4d783f8a mysqld_pre_systemd[2872]: 2022-03-23T14:05:30.936990Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp ...ore details).
Mar 23 22:05:30 79ae4d783f8a mysqld_pre_systemd[2872]: 2022-03-23T14:05:30.938849Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
Mar 23 22:05:30 79ae4d783f8a mysqld_pre_systemd[2872]: 2022-03-23T14:05:30.938880Z 0 [ERROR] Aborting
Mar 23 22:05:31 79ae4d783f8a systemd[1]: mysqld.service: control process exited, code=exited status=1
Hint: Some lines were ellipsized, use -l to show in full.
执行
[root@spark01 ~]# journalctl -xe
-- The result is failed.
Mar 23 22:09:57 79ae4d783f8a systemd[1]: Unit mysqld.service entered failed state.
Mar 23 22:09:57 79ae4d783f8a systemd[1]: mysqld.service failed.
Mar 23 22:09:57 79ae4d783f8a systemd[1]: mysqld.service holdoff time over, scheduling restart.
Mar 23 22:09:57 79ae4d783f8a systemd[1]: Stopped MySQL Server.
-- Subject: Unit mysqld.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysqld.service has finished shutting down.
Mar 23 22:09:57 79ae4d783f8a systemd[1]: Starting MySQL Server...
-- Subject: Unit mysqld.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysqld.service has begun starting up.
Mar 23 22:09:57 79ae4d783f8a mysqld_pre_systemd[7917]: 2022-03-23T14:09:57.437478Z 0 [Warning] Ignoring user change to 'mysql' because the user was set to 'www' earlier on the command line
Mar 23 22:09:57 79ae4d783f8a mysqld_pre_systemd[7917]: 2022-03-23T14:09:57.437520Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (s
Mar 23 22:09:57 79ae4d783f8a mysqld_pre_systemd[7917]: 2022-03-23T14:09:57.439410Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
Mar 23 22:09:57 79ae4d783f8a mysqld_pre_systemd[7917]: 2022-03-23T14:09:57.439443Z 0 [ERROR] Aborting
Mar 23 22:09:58 79ae4d783f8a mysqld[7941]: Initialization of mysqld failed: 0
Mar 23 22:09:58 79ae4d783f8a systemd[1]: mysqld.service: control process exited, code=exited status=1
Mar 23 22:09:59 79ae4d783f8a systemd[1]: Failed to start MySQL Server.
文件目录权限
drwxrwxrwx 1 www www 4096 Mar 23 2022 mysql
[root@79ae4d783f8a data]# cd mysql/
[root@79ae4d783f8a mysql]# ll
total 122884
-rwxrwxrwx 1 www www 56 Mar 23 22:14 auto.cnf
-rwxrwxrwx 1 www www 1680 Mar 23 22:14 ca-key.pem
-rwxrwxrwx 1 www www 281 Mar 23 22:14 ib_buffer_pool
-rwxrwxrwx 1 www www 12582912 Mar 23 2022 ibdata1
-rwxrwxrwx 1 www www 50331648 Mar 23 2022 ib_logfile0
-rwxrwxrwx 1 www www 50331648 Mar 19 16:04 ib_logfile1
-rwxrwxrwx 1 www www 12582912 Mar 23 22:14 ibtmp1
希望添加 xdebug 的插件
看了日志文件里面没有;执行了 mysql_init
也不行
spawn mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root:
Error: Access denied for user 'root'@'localhost' (using password: NO)
expect: spawn id exp6 not open
while executing
"expect {
"Re-enter new password:*" {exp_send "ASDFqwer1234####\n"}
}"
版本:newest
pvm提示不明确问题处理,明确pvm使用方法,以及pvm切换php版本后,PHP CLI 模式的使用方法。
Jul 06 13:46:41 cc69211b475e systemd[1]: Starting MySQL Server...
Jul 06 13:47:45 cc69211b475e systemd[1]: mysqld.service: control process exited, code=exited status=1
Jul 06 13:47:45 cc69211b475e systemd[1]: Failed to start MySQL Server.
Jul 06 13:47:45 cc69211b475e systemd[1]: Unit mysqld.service entered failed state.
Jul 06 13:47:45 cc69211b475e systemd[1]: mysqld.service failed.
Jul 06 13:47:46 cc69211b475e systemd[1]: mysqld.service holdoff time over, scheduling restart.
Jul 06 13:47:46 cc69211b475e systemd[1]: Stopped MySQL Server.
Jul 06 13:47:46 cc69211b475e systemd[1]: Starting MySQL Server...
Jul 06 13:47:47 cc69211b475e mysqld[157]: Unable to determine if daemon is running: No such file or directory
Jul 06 13:47:47 cc69211b475e systemd[1]: mysqld.service: control process exited, code=exited status=1
Jul 06 13:47:47 cc69211b475e systemd[1]: Failed to start MySQL Server.
Jul 06 13:47:47 cc69211b475e systemd[1]: Unit mysqld.service entered failed state.
Jul 06 13:47:47 cc69211b475e systemd[1]: mysqld.service failed.
Jul 06 13:47:47 cc69211b475e systemd[1]: mysqld.service holdoff time over, scheduling restart.
Jul 06 13:47:47 cc69211b475e systemd[1]: Stopped MySQL Server.
Jul 06 13:47:47 cc69211b475e systemd[1]: Starting MySQL Server...
Jul 06 13:47:48 cc69211b475e mysqld[180]: Unable to determine if daemon is running: No such file or directory
Jul 06 13:47:48 cc69211b475e systemd[1]: mysqld.service: control process exited, code=exited status=1
目前使用的是 newest。 想要修改默认php8的版本到php7
发现nginx.conf的是127.0.0.1:9000
正常
docker run -dit
-p 8000:80
-v /data/www:/www
--name=lnmp
2233466866/lnmp
添加 nginx配置绑定就失败
podman run -dit
-p 8000:80
-v /data/www:/www
-v /data/nginx/:/usr/local/nginx/
--name=lnmp
2233466866/lnmp
进容器,/usr/local/nginx/ 目录下只有conf目录,没有其他的,
/data/nginx/ 目录权限777
docker logs 如下
Set hostname to <dcf8fa6d3aa1>.
Initializing machine ID from random generator.
[ OK ] Reached target Paths.
[ OK ] Reached target Swap.
[ OK ] Created slice Root Slice.
[ OK ] Listening on Delayed Shutdown Socket.
[ OK ] Listening on Journal Socket.
[ OK ] Created slice System Slice.
Starting Read and set NIS domainname from /etc/sysconfig/network...
[ OK ] Reached target Slices.
Starting Configure read-only root support...
[ OK ] Started Read and set NIS domainname from /etc/sysconfig/network.
Starting Journal Service...
[ OK ] Started Configure read-only root support.
[ OK ] Reached target Local File Systems.
Starting Mark the need to relabel after reboot...
Starting Create Volatile Files and Directories...
[ OK ] Started Journal Service.
[ OK ] Started Mark the need to relabel after reboot.
[ OK ] Started Create Volatile Files and Directories.
[ INFO ] Update UTMP about System Boot/Shutdown is not active.
[DEPEND] Dependency failed for Update UTMP about System Runlevel Changes.
[ OK ] Reached target System Initialization.
[ OK ] Started Daily Cleanup of Temporary Directories.
[ OK ] Reached target Timers.
[ OK ] Listening on D-Bus System Message Bus Socket.
[ OK ] Reached target Sockets.
[ OK ] Reached target Basic System.
Starting LSB: Bring up/down networking...
[ OK ] Started Command Scheduler.
Starting Cleanup of Temporary Directories...
[ OK ] Started Cleanup of Temporary Directories.
[FAILED] Failed to start LSB: Bring up/down networking.
See 'systemctl status network.service' for details.
[ OK ] Reached target Multi-User System.
[ OK ] Reached target Network.
Starting MySQL Server...
Starting Nginx service....
Starting Owner service....
Starting Php7 service....
[ OK ] Reached target Network is Online.
[FAILED] Failed to start Nginx service..
See 'systemctl status nginx.service' for details.
[ OK ] Started Php7 service..
[ OK ] Started Owner service..
[ OK ] Started MySQL Server.
Failed to get D-Bus connection: No such file or directory
增加对php8的支持
支持pvm切换到php8
支持owner修改php8
参考以下文档安装php8
https://note.so1234.top/linux/php8.html
php8需要包含以下扩展
bcmath
bz2
calendar
Core
ctype
curl
date
dom
ereg
fileinfo
filter
gd
hash
iconv
intl
json
libxml
mbstring
mcrypt
memcache
memcached
mongodb
mysql
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
redis
Reflection
session
SimpleXML
sockets
SPL
sqlite3
standard
swoole
tokenizer
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib
Zend OPcache
将 nginx.conf 中的日志配置指向 /dev/stdout
error_log /dev/stderr notice;
access_log /dev/stdout main;
nginx -t 返回:
nginx: the configuration file /usr/local/nginx//conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx//conf/nginx.conf test is successful
但却不可访问
使用 docker logs -f (容器名) 也无日志输出
希望大佬出个arm64的。。。。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.