์ƒˆ์†Œ์‹

์ธ๊ธฐ ๊ฒ€์ƒ‰์–ด

๐Ÿ’ป Linux

CentOS7 python,tomcat ์›น ๊ตฌ์ถ•

  • -
๋ฐ˜์‘ํ˜•

Python ์›น ๊ตฌ์ถ•

yum -y install python

cd /var/www/cgi-bin

# ์•„ํŒŒ์น˜ ์„ค์ • ํŒŒ์ผ

vim /etc/httpd/conf/httpd.conf

302๋ฒˆ์งธ ์ค„ #AddHandler cgi-script .cgi .py
systemctl restart httpd

cd /var/www/cgi-bin

vim first.py

#!/usr/bin/env python

print "Content-type: text/html\\n\\n"
print "\\n"
print "
" print "Python Test Page in [Benmin.com](<http://benmin.com/>)" print "\\n\\n" chmod 707 first.py cd /var/www

Tomcat ์›น ๊ตฌ์ถ•

yum -y install tomcat java //ํ†ฐ์บฃ ์ž๋ฐ” ์„ค์น˜
java -version //์ž๋ฐ” ๋ฒ„์ „ ํ™•์ธ

systemctl restart tomcat
systemctl status tomcat
systemctl enable tomcat

netstat -natlp | grep java // 8080 ํฌํŠธ ์‚ฌ์šฉ
lsof -i tcp:8080 // ํฌํŠธ ํ™•์ธ

systemctl stop firewalld // ๋ฐฉํ™”๋ฒฝ ๋„๊ธฐ
setenforce 0

// ํ†ฐ์บฃ GUIํ™˜๊ฒฝ ์„ค์น˜
yum -y install tomcat-webapps

// ํ†ฐ์บฃ ์„ค์ •ํŒŒ์ผ
vim /usr/share/tomcat/conf/tomcat-users.xml

// ์ฃผ์„ ์ œ๊ฑฐ ํ›„ ํŒจ์Šค์›Œ๋“œ๋งŒ ๋ณ€๊ฒฝ , ์ž๋ฐ” ์ฃผ์„ <!— —>

// ํ†ฐ์บฃ ๊ธฐ๋ณธ ๋””๋ ‰ํ„ฐ๋ฆฌ
cd /usr/share/tomcat/webapps/ROOT/

// ๊ธฐ๋ณธ ํŒŒ์ผ
index.jsp

// index.jsp ํŒŒ์ผ ๋ฐฑ์—…
mv index.jsp index.jsp.bak

// index.jsp ํŒŒ์ผ ์ƒ์„ฑ
vim index.jsp

<html>
<head>
<title>Tomcat Test</title>
</head>
<body>
<div style="width: 100%; font-size:80px; font-weigth:bold; text-align: center;">
Benmin's Tomcat test

<START OF JAVA CODES>
<%
out.println("Hello World!!!");
out.println("<BR>This is first JSP APP ");
%>
<END OF JAVA CODES>

</div>
</body>
</html>

// ํ†ฐ์บฃ ์‚ฌ์ดํŠธ
<http://192.168.111.100:8080>
๋ฐ˜์‘ํ˜•
Contents

ํฌ์ŠคํŒ… ์ฃผ์†Œ๋ฅผ ๋ณต์‚ฌํ–ˆ์Šต๋‹ˆ๋‹ค

์ด ๊ธ€์ด ๋„์›€์ด ๋˜์—ˆ๋‹ค๋ฉด ๊ณต๊ฐ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.