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
![](https://img-blog.csdn.net/20180330160353773?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3lhbmd5dW5fMTk5OQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
这是配置文件4的问题,我的配置文件如下:
![](https://img-blog.csdn.net/20180330161036702?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3lhbmd5dW5fMTk5OQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
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
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
相关文章推荐
- ubuntu 安装Tomcat时遇到的一点小问题
- Ubuntu 下安装tomcat8.0遇到的问题以及解决办法
- Ubuntu Server9 + Tomcat + mysql + Jdk 安装后遇到的一些常见问题
- ubuntu下tomcat安装配置及idea下建立jps工程中遇到的小问题
- ubuntu下安装nginx+tomcat+jdk所遇到的所有问题
- 关于在ubuntu10.04版本(而且该版本安装了OPEN JDK时),安装SUN JAVA遇到了几个问题并且安装成功
- Ubuntu 12.04 安装 Tomcat8 遇到的问题
- ubuntu安装php7.0.3遇到的问题
- ubuntu 下 安装 eclipse和 tomcat 遇到到一些问题
- Ubuntu 安装PHP的LDAP扩展时遇到的问题以及解决方案
- Ubuntu 12.04 安装 Tomcat8 遇到的问题
- Ubuntu 下安装tomcat和配置eclipse的遇到的问题的一点心得。
- Ubuntu Server9 + Tomcat + mysql + Jdk 安装后遇到的一些常见问题
- ubuntu安装rubymine遇到的问题
- 安装ubuntuserver和lamp遇到的问题,google解决的答案
- Tomcat 5.5 安装为服务时遇到的两个问题及解决
- 关于在vmware7.0 安装ubuntu10.04 遇到的问题
- 安装php的tokyo_tyrant扩展时遇到的问题,以及解决方法
- 在ubuntu10.10中安装VMWare Tool,遇到The path " " is not valid 的问题
- 硬盘安装Ubuntu9.10 的过程,遇到的问题及解决方法