VEAR 617ecdbbc8 修改nginx配置,添加标题 | 2 năm trước cách đây | |
---|---|---|
.. | ||
README.md | 2 năm trước cách đây | |
nginx.conf | 2 năm trước cách đây | |
nginx80.conf | 2 năm trước cách đây | |
run.sh | 2 năm trước cách đây |
https://www.cnblogs.com/lhd1998/p/13297229.html
docker安装redis
docker pull redis
运行redis
docker run -p 6379:6379 -v $PWD/data:/data -d redis redis-server --appendonly yes --requirepass "123456"
docker pull mysql:5.7
docker images
启动mysql容器
-v /mydata/mysql/data:/var/lib/mysql \
-v /mydata/mysql/conf:/etc/mysql \
-e MYSQL_ROOT_PASSWORD=123456 \
-d mysql:5.7
进入容器
```docker exec -it mysql /bin/bash```
配置MySQL
```
//进入挂载数据卷 包含 conf、data、logs目录
cd /mydata/mysql/
//进入配置文件目录
cd conf/
```
创建MySQL配置文件
配置文件权限不允许设置为777, 配置为777, mysql在启动时会自动忽略该配置文件(Warning: World-writable config file ‘/etc/my.cnf’ is ignored),应将配置文件权限设置为644 chmod 644 my.cnf
。
cat > my.cnf <<-EOF
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
skip-name-resolve
EOF
重启MySQL容器
```
docker restart mysql
```
进入容器确认配置
```
docker exec -it mysql /bin/bash
cd /etc/mysql/
cat my.cnf
```
Docker启动容器自启
```
docker update mysql --restart=always
```
/usr/java/jdk1.8.0_221
在路径/etc/profile
添加以下配置
```
export JAVA_HOME=/usr/java/jdk1.8.0_221
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib
```
执行命令 source /etc/profile
查看是否安装成功 java -version
教程 https://www.cnblogs.com/jiehao-yu/p/14754780.html
安装路径/usr/local/nginx
进入/usr/local/nginx/sbin目录 cd /usr/local/nginx/sbin
停止nginx ./nginx -s stop
重启nginx ./nginx -s reload
启动nginx ./nginx
前端文件路径 /usr/local/nginx/dist
如果提示一下错误
nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)
* 1.修改nginx.conf中pid pid /usr/local/nginx/logs/nginx.pid
* 2.创建logs文件夹
* 3.在sbin目录下执行 ./nginx
nginx安装命令
```
./configure \
--prefix=/usr/local/nginx \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/temp/nginx/client \
--http-proxy-temp-path=/var/temp/nginx/proxy \
--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
--http-scgi-temp-path=/var/temp/nginx/scgi \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-file-aio \
--with-http_realip_module
```
注意:阿里云默认关闭,开放端口后需要配置安全组
查看防火墙 sudo systemctl status firewalld
关闭防火墙 sudo systemctl stop firewalld
打开防火墙 sudo systemctl start firewalld
开放80端口 firewall-cmd --zone=public --add-port=443/tcp --permanent
重启 firewall-cmd --reload
查看端口 firewall-cmd --list-port
配置 https
firewall-cmd --zone=public --add-port=443/tcp --permanent
* 安全组中添加443
* nginx配置文件
* 测试环境开放的端口
* 开放80端口 firewall-cmd --zone=public --add-port=80/tcp --permanent
* 开放443端口 firewall-cmd --zone=public --add-port=443/tcp --permanent
* 开放3306端口 firewall-cmd --zone=public --add-port=3306/tcp --permanent
## 2、服务运行
* 服务路径
* 后台接口路径 http://39.108.56.127:8800/doc.html
* 前端登录 http://39.108.56.127:1888/