ubuntu nginx runing zentaopms

ubuntu nginx runing zentaopms

安装 nginx 和 PHP 运行环境

sudo aptitude install nginx nginx-doc
sudo aptitude install php php-dev php-fpm
sudo aptitude install php-apcu php-cli
sudo aptitude install php-mbstring php-gd php-curl php-json php-xml php-curl
sudo aptitude install php-mysql php-sqlite3 php-pgsql

查看 PHP 模块插件

php -m | grep -iE "pdo|mysql|json|filter|openssl|mbstring|zlib|curl|gd|iconv"

配置 nginx 站点文件

touch /etc/nginx/sites-available/zentaopms
ln -s /etc/nginx/sites-available/zentaopms /etc/nginx/sites-enabled/zentaopms
vi /etc/nginx/sites-available/zentaopms

server {
	listen 9863 ssl http2;

	server_name localhost;
	
	ssl_certificate /etc/nginx/ssl/self.crt;
	ssl_certificate_key /etc/nginx/ssl/self.key;

	ssl_protocols TLSv1.2 TLSv1.3;
	ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384;
	ssl_prefer_server_ciphers off;
	ssl_session_cache shared:SSL:10m;
	ssl_session_timeout 1d;

	location / {
		client_max_body_size 512M;
		root /var/www/zentaopms/www;
		index index.php index.html index.htm;

		try_files $uri $uri/ /index.php?$query_string;
	}
	
	location ~ .php$ {
		client_max_body_size 512M;
		root /var/www/zentaopms/www;
		index index.php index.html index.htm;

		include snippets/fastcgi-php.conf;
		fastcgi_pass unix:/run/php/php8.3-fpm.sock;
		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
		include fastcgi_params;
	}

	location ~ ^/(data|config|logs)/ {
		deny all;
	}
}

安装 mariadb 数据库

sudo aptitude install mariadb-server mariadb-client

初始化 mariadb 数据库 ( 设置 数据库 root 用户密码 )

mysql_secure_installation

创建 zentao 用户数据库

mysql -u root -h localhost -p

select * from `mysql`.`db` where `Host`='localhost' and `Db`='zentao' and `User`='zentao_user';
select * from `mysql`.`user` where `Host`='localhost' and `User`='zentao_user';

delete from `mysql`.`db` where  `Host`='localhost' and `Db`='zentao' and `User`='zentao_user';
delete from `mysql`.`user` where  `Host`='localhost' and `User`='zentao_user';
drop database `zentao`;
flush privileges;

create database zentao character set utf8mb4 collate utf8mb4_unicode_ci;
grant all privileges on zentao.* to 'zentao_user'@'localhost' identified by 'your_secure_password';
flush privileges;

下载 zentao 部署文件压缩包

wget https://dl.zentao.net/zentao/21.7/zentao-21.7.7-php8.1.zip
unzip zentao-21.7.7-php8.1.zip
chown -R www-data:www-data zentaopms

重载 nginx 配置

sudo systemctl reload nginx.service

网页浏览器访问 zentao 的 install.php 进行安装 ( 设置使用的数据库用户名及密码,并设置公司管理员用户及密码 )

https://your.host.ip.addr:port/install.php

修改 zentao 的 my.php 配置 ( 关闭 CSRF 验证 )

vi /var/www/zentaopms/config/my.php

$config->framework->filterCSRF = false; 

修改 php 的上传文件大小限制

vi /etc/php/8.3/fpm/php.ini
vi /etc/php/8.3/apache2/php.ini
vi /etc/php/8.3/cli/php.ini

post_max_size = 512M
upload_max_filesize = 150M
default_socket_timeout = 300

posted @ 2026-01-01 17:27  lsgxeva  阅读(26)  评论(0)    收藏  举报