Linux配置nginx

  1. 下载nginx

    yum install nginx
    
  2. 开启nginx

    systemctl start nginx
    
  3. 停止nginx

    systemctl stop nginx
    
  4. 检查nginx状态

    systemctl status nginx
    
  5. 重新加载nginx配置

    nginx -s reload
    
  6. 打开nginx配置

    cd etc/nginx
    
    vim nginx.conf
    

开放端口

查看防火墙开放的端口

firewall-cmd --list-ports

开放端口

firewall-cmd --zone=public --add-port=3306/tcp --permanent

重新加载防火墙

firewall-cmd --reload 

关闭端口

firewall-cmd --zone=public --remove-port=8080/tcp --permanent 

Linux配置java

下载java

yum install java-17-openjdk

运行jar包

java -jar 包名.jar

nohup后台运行jar包

nohup java -jar polaris.jar &

Linux配置mysql

下载mysql

yum install mysql-server mysql

开启mysql

sudo systemctl start mysqld

检查mysql状态

sudo systemctl status mysqld

关闭mysql

sudo systemctl stop mysqld

开启自动启动

sudo systemctl enable mysqld

root进入mysql

mysql -u root mysql

设置密码

ALTER USER 'root'@'localhost' IDENTIFIED BY 'your_new_password';

登陆mysql

mysql -u root -p

远程连接mysql查看访问权限

SELECT User, Host, Grant_priv FROM mysql.user;

开启权限

update mysql.user set Host = '%' where User='root';

刷新权限

FLUSH PRIVILEGES;

退掉mysql命令

quit

问题汇总

403 forbidden
  • nginx没有web目录的操作权限,会出现403错误

    sudo chmod 777 -R file

文章作者: Polaris
版权声明: 本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Polaris
服务器 nginx mysql java linux
喜欢就支持一下吧