1、Tomcat启动相关命令
查看Tomcat是否启动:ps -ef|grep java
切换root权限: sudo -i
启动Tomcat(需要切换到安装位置的bin目录用root权限):./startup.sh
关闭 Tomcat(需要切换到安装位置的bin目录用root权限):./shutdown.sh
查看公网IP地址:curl ipinfo.io
补充:
启动Tomcat时出现 permission denied说明用户权限不足
如果你是root登陆的话(不是的话,切换到root用户,对*.sh赋可执行的权限)
chmod +x *.sh ,然后在重启tomcat 执行startup.sh就可以了
vim 文件名 可以查看文件内容 :wq 退出文本编辑器
注意:tomcat启动成功后,外网访问时总是404找不到页面问题
1、将Tomcat的端口号加入阿里云控制台中的安全组
2、加入安全组后外网访问Tomcat仍然404找不到页面问题
检查server.xml配置的默认页面存放位置,注意该位置指的Tomcat安装路径的根路径(我就犯了放错页面位置的错误,导致一直访问不到自己想访问的网页)
Using username "cdog".
cdog@www.cdogc.com's password:
Last login: Fri May 25 22:11:36 2018 from 221.218.210.127
Welcome to Alibaba Cloud Elastic Compute Service !
[cdog@server ~]$ ls
data setup
[cdog@server ~]$ cd /
[cdog@server /]$ ls
bin dev home lib64 media npm-debug.log proc r
boot etc lib lost+found mnt opt root s
[cdog@server /]$ cd /home/cdog/setup/tomcat7/bin
[cdog@server bin]$ ls
bootstrap.jar daemon.sh startup.sh
catalina.bat digest.bat tomcat-jul
catalina.sh digest.sh tomcat-nat
catalina-tasks.xml setclasspath.bat tool-wrapp
commons-daemon.jar setclasspath.sh tool-wrapp
commons-daemon-native.tar.gz shutdown.bat version.ba
configtest.bat shutdown.sh version.sh
configtest.sh startup.bat
[cdog@server bin]$ chmod u+x*.sh
chmod: missing operand after ‘u+x*.sh’
Try 'chmod --help' for more information.
[cdog@server bin]$ chmod --help
Usage: chmod [OPTION]... MODE[,MODE]... FILE...
or: chmod [OPTION]... OCTAL-MODE FILE...
or: chmod [OPTION]... --reference=RFILE FILE...
Change the mode of each FILE to MODE.
With --reference, change the mode of each FILE to that of
-c, --changes like verbose but report only when
-f, --silent, --quiet suppress most error messages
-v, --verbose output a diagnostic for every fil
--no-preserve-root do not treat '/' specially (the
--preserve-root fail to operate recursively on '/
--reference=RFILE use RFILE's mode instead of MODE
-R, --recursive change files and directories recu
--help display this help and exit
--version output version information and exit
Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+
GNU coreutils online help: <http://www.gnu.org/software/co
For complete documentation, run: info coreutils 'chmod inv
[cdog@server bin]$ sudo -i
[sudo] password for cdog:
[root@server ~]# ls
node_modules workspace
[root@server ~]# cd /
[root@server /]# ls
bin dev home lib64 media npm-debug.log proc r
boot etc lib lost+found mnt opt root s
[root@server /]# cd home/cdog/setup/tomcat7/bin
[root@server bin]# ls
bootstrap.jar daemon.sh startup.sh
catalina.bat digest.bat tomcat-jul
catalina.sh digest.sh tomcat-nat
catalina-tasks.xml setclasspath.bat tool-wrapp
commons-daemon.jar setclasspath.sh tool-wrapp
commons-daemon-native.tar.gz shutdown.bat version.ba
configtest.bat shutdown.sh version.sh
configtest.sh startup.bat
[root@server bin]# ./startup.sh
-bash: ./startup.sh: Permission denied
[root@server bin]# chmod +x *.sh
[root@server bin]# ./startup.sh
Using CATALINA_BASE: /home/cdog/setup/tomcat7
Using CATALINA_HOME: /home/cdog/setup/tomcat7
Using CATALINA_TMPDIR: /home/cdog/setup/tomcat7/temp
Using JRE_HOME: /
Using CLASSPATH: /home/cdog/setup/tomcat7/bin/bodong/setup/tomcat7/bin/tomcat-juli.jar
Tomcat started.
[root@server bin]# ps -ef|grep java
root 9162 1 0 22:20 pts/0 00:00:02 //bin/jav -Djava.util.logging.config.file=/home/cdog/setup/tomcat7/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Dignore.endorsed.dirs= -classpath /home/cdog/setup/tomcat7/bin/bootstrap.jar:/home/cdog/setup/tomcat7/bin/tomcat-juli.jar -Dcatalina.base=/home/cdog/setup/tomcat7 -Dcatalina.home=/home/cdog/setup/tomcat7 -Djava.io.tmpdir=/home/cdog/setup/tomcat7/temp org.apache.catalina.startup.Bootstrap start
root 9176 9123 0 22:24 pts/0 00:00:00 grep --color=auto java
(出现这些提示信息代表启动成功,pid=9162)
[root@server bin]#