您的位置:首页 > 运维架构 > Tomcat

ubuntu下安装nginx+php 遇到的问题 并且与tomcat共存

2018-03-30 16:12 489 查看
1、安装nginx
apt install nginx
2、安装php7.0
apt install php7.0
3、php7.0-fpm(php与nginx之间的连接器)
apt install php7.0-fpm
4、配置文件/etc/nginx/sites-enabled/default
location ~ \.php$ {
                root    /var/www/html;                                  #php文件所在的根目录
                fastcgi_pass 127.0.0.1:9000;                      #fpm监听的IP和端口
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;

        }
5、启动两个进程
service nginx start
service php7.0-fpm start
6、编辑目录/var/www/html文件
7、启动nginx时遇到的问题
查看nginx启动失败的原因:systemctl status nginx.service



这是配置文件4的问题,我的配置文件如下:



8、nginx与tomcat可以共存,只需要端口号不一样就可以
9、tomcat重启服务
编辑文件vim /etc/init.d/tomcatcd /root/temp/apache-tomcat-8.5.29/
#./bin/startup.sh

case "$1" in
start)
./bin/startup.sh
exit 1;;

stop)
./bin/shutdown.sh
exit 1;;
esac启动:/etc/init.d/tomcat start
查看tomcat是否启动:ps -ef |grep tomcat

停止进程:pkill -9 tomcat
占用80端口的:netstat -na | grep 80
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: