파일업로드
vsftpd
<= proftpd
익명으로 접속되어 pub이란 경로 접속이 된다
root로 접속이 안된다
Anonymous_enable=NO로 바꿔준다
master로 로그인 가능
파일 업로드 권한 기본이 755
umask를 077로 바꿈
077로 바뀜
홈 디렉토리 위로 이동 제한 여부 설정(기본값 NO)
master로 로그인 후 tester1이나 tester2 접근 안됨
tester1 접속 안됨
master외에 tester1도 추가
tester1 연결 됨
이 아래가 최종적으로 확실한 개념임
100 chroot_local_user=YES
101
102 allow_writeable_chroot=YES
103
104 chroot_list_enable=YES
105 # (default follows)
106 chroot_list_file=/etc/vsftpd/chroot_list
1. 제한접속
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
* 접속 가능한 계정 리스트
2. 상위 디렉토리 이동 불가
chroot_local_user=YES
allow_writeable_chroot=YES
에러가 날 경우
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
먼저 재시작 나중에 제거
위와 같이 지정하고 마스터로 로그인하면
마스터 상위 접근이 안된다, 테스터로 로그인해도 안된다
위와 같이 설정하면 chroot_list에 작성된 계정은 상위로 올라갈 수 있다.
reboot하면 서버에 의해 연결 종료됨 나오면서 ftp 접속이 안됨
서버가 켜지고 꺼지고 상관없이 ftp가 계속 유지되게 하려면
리부트 시키고 ftp 접속하면 아래와 같이 접속이 가능하다
리눅스에서 데이터베이스 설치하기 - mariadb
데이터베이스
Oracle
Linux 가능하지만 어려움
MySQL
.. 상용버전
=> mariaDB를 설치한다(구조 같음)
설치 완료
설치 완료
[root@localhost ~]# mysql_install_db --user=mysql
Installing MariaDB/MySQL system tables in '/var/lib/mysql' ...
180822 13:08:54 [Note] /usr/libexec/mysqld (mysqld 5.5.60-MariaDB) starting as process 6072 ...
OK
Filling help tables...
180822 13:08:54 [Note] /usr/libexec/mysqld (mysqld 5.5.60-MariaDB) starting as process 6079 ...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:
'/usr/bin/mysqladmin' -u root password 'new-password'
'/usr/bin/mysqladmin' -u root -h localhost.localdomain password 'new-password'
Alternatively you can run:
'/usr/bin/mysql_secure_installation'
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.
You can start the MariaDB daemon with:
cd '/usr' ; /usr/bin/mysqld_safe --datadir='/var/lib/mysql'
You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/mysql-test' ; perl mysql-test-run.pl
Please report any problems at http://mariadb.org/jira
The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/
[root@localhost ~]# systemctl enable mariadb
[root@localhost ~]# systemctl start mariadb
MariaDB [mysql]> select host, user, password from user;
+----------------------+------+----------+
| host | user | password |
+----------------------+------+----------+
| localhost | root | |
| locahost.localdomain | root | |
| 127.0.0.1 | root | |
| ::1 | root | |
| localhost | | |
| locahost.localdomain | | |
+----------------------+------+----------+
6 rows in set (0.00 sec)
[root@locahost services]# mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 5.5.60-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
[root@locahost services]# mysqladmin -u root password '123456'
[root@locahost services]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
로그인 하는 방법
[root@locahost services]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 5.5.60-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [mysql]> select host, user, password from user;
+----------------------+------+-------------------------------------------+
| host | user | password |
+----------------------+------+-------------------------------------------+
| localhost | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| locahost.localdomain | root | |
| 127.0.0.1 | root | |
| ::1 | root | |
| localhost | | |
| locahost.localdomain | | |
+----------------------+------+-------------------------------------------+
6 rows in set (0.01 sec)
윈도우에서 들어오고 싶은데 위를 보면 권한이 없다 그래서 아래와 같이 권한을 추가해주자
MariaDB [mysql]> grant all privileges on *.* to 'root'@'%' identified by '1234';
Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql]> select host, user, password from user;
+----------------------+------+-------------------------------------------+
| host | user | password |
+----------------------+------+-------------------------------------------+
| localhost | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| locahost.localdomain | root | |
| 127.0.0.1 | root | |
| ::1 | root | |
| localhost | | |
| locahost.localdomain | | |
| % | root | *A4B6157319038724E3560894F7F932C8886EBFCF |
+----------------------+------+-------------------------------------------+
7 rows in set (0.00 sec)
% host가 생겼다.(접속하고 싶은 곳 어디든 가능)
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
윈도우로 가서 shift + 마우스 우클릭한다
C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)
접속하자
C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -h 192.168.111.128 -u root -p
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.5.60-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
이제 테이블을 만들고 데이터도 입력해보자
MariaDB [test]> create table testtbl ( col1 varchar(10), col2 varchar(10));
Query OK, 0 rows affected (0.00 sec)
MariaDB [test]> desc testtbl;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| col1 | varchar(10) | YES | | NULL | |
| col2 | varchar(10) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
2 rows in set (0.01 sec)
MariaDB [test]> insert into testtbl values ('aaa', '가나다');
Query OK, 1 row affected, 1 warning (0.00 sec)
MariaDB [test]> select * from testtbl;
+------+------+
| col1 | col2 |
+------+------+
| aaa | ??? |
+------+------+
1 row in set (0.00 sec)
한글이 깨짐
자 이제 이클립스에서 MySQLEx01이란 Dynamic Web Project를 만들어 주자
WebContent.test
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.PreparedStatement" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.SQLException" %>
<%
String url = "jdbc:mysql://192.168.111.128:3306/test?useSSL=false
&useTimezone=true&serverTimezone=UTC";
String user = "root";
String password = "1234";
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
// mysql --
Class.forName("com.mysql.cj.jdbc.Driver");
conn = DriverManager.getConnection(url, user, password);
out.println("연결성공");
} catch(ClassNotFoundException e) {
System.out.println("[에러] " + e.getMessage());
}
%>
mysql connector-java가 최신버전이 아니므로 아래 사이트에서
mariadb-java-client-2.2.6.jar을 다운받는다
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.PreparedStatement" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.SQLException" %>
<%
String url = "jdbc:mysql://192.168.111.128:3306/test?useSSL=false&useTimezone=true&serverTimezone=UTC";
String user = "root";
String password = "1234";
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
// mysql --
Class.forName("com.mysql.cj.jdbc.Driver");
conn = DriverManager.getConnection(url, user, password);
String sql = "select col1, col2 from testtbl";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
while(rs.next()) {
out.println(rs.getString("col1"));
out.println(rs.getString("col2"));
}
//out.println("연결성공");
} catch(ClassNotFoundException e) {
System.out.println("[에러] " + e.getMessage());
}
%>
MariaDB [test]> show variables like 'c%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
| collation_connection | utf8_general_ci |
| collation_database | latin1_swedish_ci |
| collation_server | latin1_swedish_ci |
| completion_type | NO_CHAIN |
| concurrent_insert | AUTO |
| connect_timeout | 10 |
+--------------------------+----------------------------+
14 rows in set (0.00 sec)
MariaDB [test]> exit
Bye
[root@locahost services]# systemctl stop mariadb
[root@locahost services]# vi /etc/my.cnf.d/client.cnf
default-character-set=utf8 추가
[root@locahost services]# vi /etc/my.cnf.d/mysql-clients.cnf
default-character-set=utf8 추가
[root@locahost services]# vi /etc/my.cnf.d/server.cnf
collation-server=utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server=utf8
추가
MariaDB [(none)]> show variables like 'c%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
| collation_connection | utf8_general_ci |
| collation_database | utf8_unicode_ci |
| collation_server | utf8_unicode_ci |
| completion_type | NO_CHAIN |
| concurrent_insert | AUTO |
| connect_timeout | 10 |
+--------------------------+----------------------------+
14 rows in set (0.00 sec)
mysql에서 한글이 출력되게 하기 위해 위와 같이 설정하였고 이를 반영되게 하기 위해 기존 테이블을 삭제하고 다시 만들어줘야 적용이 된다.
MariaDB [test]> drop table testtbl;
Query OK, 0 rows affected (0.00 sec)
MariaDB [test]> create table testtbl (
-> col1 varchar(10),
-> col2 varchar(20)
-> );
Query OK, 0 rows affected (0.00 sec)
MariaDB [test]> desc testtbl;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| col1 | varchar(10) | YES | | NULL | |
| col2 | varchar(20) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
MariaDB [test]> insert into testtbl values ('aaa', '가나다');
Query OK, 1 row affected (0.00 sec)
MariaDB [test]> desc testtbl;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| col1 | varchar(10) | YES | | NULL | |
| col2 | varchar(20) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
MariaDB [test]> select * from testtbl;
+------+-----------+
| col1 | col2 |
+------+-----------+
| aaa | 가나다 |
+------+-----------+
1 row in set (0.00 sec)
위와 같이 이클립스에서 원격으로 접속하여 검색하였을 때도 검색이 된다.
model1 게시판을 mariadb로 연결하기
1. db - linux maria
db table 설계 바꾸어야 함
insert 문장(auto_increment) 포함
2. context.xml
3. DAO 수정
1. mariaDB에서 board1 테이블을 만들고 샘플값을 입력한다.
create table board1 (
seq int not null primary key auto_increment,
subject varchar(100) not null,
writer varchar(30) not null,
mail varchar(50),
password varchar(10) not null,
content varchar(2000),
hit int not null,
wip varchar(15) not null,
wdate datetime not null
);
insert into board1 values (
0, 'subject', 'name', 'test@test.com',
'1234', 'content', 0, '000.000.000.000', 'now()'
);
oracle의 nextval은 mysql에서 테이블 컬럼에서 auto_increment를 추가해주면 자동으로 nextval 기능을 한다.
2. context.xml 수정
<?xml version="1.0" encoding="utf-8" ?>
<Context>
<Resource
name="jdbc/mysql"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://192.168.111.128:3306/test?useSSL=false&useTimezone=true&serverTimezone=UTC"
username="root"
password="1234"
maxTotal="20"
maxWaitMillis="5000"/>
</Context>
3. BoardDAO 수정
this.datasource = (DataSource)envCtx.lookup("jdbc/mysql");
위와 같이 jdbc/mysql로 설정을 context.xml과 맞춰줘야 한다. oracle에선 oracle1으로 되어 있었다.
package model1;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import model1.BoardTO;
// 각 페이지당 할일
public class BoardDAO {
// jsp 처리할 일을 메소드화
// jsp 페이지와 1 : 1
private DataSource datasource = null;
public BoardDAO() {
// 데이터 소스를 얻어 냄
try {
Context initCtx = new InitialContext();
Context envCtx = (Context)initCtx.lookup("java:comp/env");
this.datasource = (DataSource)envCtx.lookup("jdbc/mysql");
} catch (NamingException e) {
System.out.println("[에러] : " + e.getMessage());
}
}
public void boardWrite() {
// 할 일 없음
}
public int boardWriteOk(BoardTO to) {
Connection conn = null;
PreparedStatement pstmt = null;
int flag = 1;
try {
conn = datasource.getConnection();
String sql = "insert into board1 values (0, ?, ?, ?, ?, ?, 0, ?, now())";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, to.getSubject());
pstmt.setString(2, to.getWriter());
pstmt.setString(3, to.getMail());
pstmt.setString(4, to.getPassword());
pstmt.setString(5, to.getContent());
pstmt.setString(6, to.getWip());
int result = pstmt.executeUpdate();
if(result == 1) {
flag = 0;
}
} catch(SQLException e) {
System.out.println("[에러] " + e.getMessage());
} finally {
if(pstmt != null) try {pstmt.close();} catch(SQLException e) {};
if(conn != null) try {conn.close();} catch(SQLException e) {};
}
return flag;
}
public ArrayList<BoardTO> boardList() {
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
int totalRecord = 0;
ArrayList<BoardTO> lists = new ArrayList<>();
try {
conn = datasource.getConnection();
String sql = "select seq, subject, writer, "
+ "date_format(wdate, '%Y.%m.%d') wdate, hit, "
+ "datediff(now(), wdate) wgap "
+ "from board1 order by seq desc";
pstmt = conn.prepareStatement(sql);
pstmt = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
rs = pstmt.executeQuery();
// 커서를 맨 마지막행으로 이동
rs.last();
// 데이터 개수가 나옴
totalRecord = rs.getRow();
rs.beforeFirst();
while(rs.next()) {
BoardTO to = new BoardTO();
to.setSeq(rs.getString("seq"));
to.setSubject(rs.getString("subject"));
to.setWriter(rs.getString("writer"));
to.setWdate(rs.getString("wdate"));
to.setHit(rs.getString("hit"));
to.setWgap(rs.getInt("wgap"));
lists.add(to);
}
} catch(SQLException e) {
System.out.println("[에러] " + e.getMessage());
} finally {
if(rs != null) try {rs.close();} catch(SQLException e) {};
if(pstmt != null) try {pstmt.close();} catch(SQLException e) {};
if(conn != null) try {conn.close();} catch(SQLException e) {};
}
return lists;
}
public BoardTO boardView(BoardTO to) {
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
conn = datasource.getConnection();
// 조회수
String sql = "update board1 set hit = hit + 1 where seq=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, to.getSeq());
pstmt.executeUpdate();
// 조회
sql = "select subject, writer, wdate, hit, content, mail from board1 where seq = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, to.getSeq());
rs = pstmt.executeQuery();
if(rs.next()) {
to.setSubject(rs.getString("subject"));
to.setWriter(rs.getString("writer"));
to.setWdate(rs.getString("wdate"));
to.setHit(rs.getString("hit"));
to.setContent(rs.getString("content") == null ? "" : rs.getString("content").replaceAll("\n", "<br />"));
to.setMail(rs.getString("mail").equals("@") ? "" : rs.getString("mail"));
}
} catch(SQLException e) {
System.out.println("[에러] " + e.getMessage());
} finally {
if(rs != null) try {rs.close();} catch(SQLException e) {};
if(pstmt != null) try {pstmt.close();} catch(SQLException e) {};
if(conn != null) try {conn.close();} catch(SQLException e) {};
}
return to;
}
public int boardModify(BoardTO to) {
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
int flag = 2;
try {
conn = datasource.getConnection();
String sql = "select writer, subject, content, mail from board1 where seq = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, to.getSeq());
rs = pstmt.executeQuery();
if(rs.next()) {
to.setWriter(rs.getString("writer"));
to.setSubject(rs.getString("subject"));
to.setContent(rs.getString("content") == null ? "" : rs.getString("content").replaceAll("\n", "<br />"));
to.setMail(rs.getString("mail"));
int result = pstmt.executeUpdate();
if(result == 1) {
// 정상
flag = 0;
} else if (result == 0) {
// 비밀번호 오류
flag = 1;
}
}
} catch(SQLException e) {
System.out.println("[에러] " + e.getMessage());
} finally {
if(rs != null) try {rs.close();} catch(SQLException e) {};
if(pstmt != null) try {pstmt.close();} catch(SQLException e) {};
if(conn != null) try {conn.close();} catch(SQLException e) {};
}
return flag;
}
public int boardModifyOk(BoardTO to) {
Connection conn = null;
PreparedStatement pstmt = null;
int flag = 2;
try {
conn = datasource.getConnection();
String sql = "update board1 set subject=?, mail=?, password=?, content=? where seq = ? and password = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, to.getSubject());
pstmt.setString(2, to.getMail());
pstmt.setString(3, to.getPassword());
pstmt.setString(4, to.getContent());
pstmt.setString(5, to.getSeq());
pstmt.setString(6, to.getPassword());
int result = pstmt.executeUpdate();
if(result == 1) {
// 정상
flag = 0;
} else if (result == 0) {
// 비밀번호 오류
flag = 1;
}
} catch(SQLException e) {
System.out.println("[에러] " + e.getMessage());
} finally {
if(pstmt != null) try {pstmt.close();} catch(SQLException e) {};
if(conn != null) try {conn.close();} catch(SQLException e) {};
}
return flag;
}
public void boardDelete() {
// 할 일 없음
}
public int boardDeleteOk(BoardTO to) {
Connection conn = null;
PreparedStatement pstmt = null;
int flag = 2;
try {
conn = datasource.getConnection();
String sql = "delete from board1 where seq = ? and password = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, to.getSeq());
pstmt.setString(2, to.getPassword());
int result = pstmt.executeUpdate();
if(result == 1) {
// 정상
flag = 0;
} else if (result == 0) {
// 비밀번호 오류
flag = 1;
}
} catch(SQLException e) {
System.out.println("[에러] " + e.getMessage());
} finally {
if(pstmt != null) try {pstmt.close();} catch(SQLException e) {};
if(conn != null) try {conn.close();} catch(SQLException e) {};
}
return flag;
}
}
String sql = "select seq, subject, writer, "
+ "date_format(wdate, '%Y.%m.%d') wdate, hit, "
+ "datediff(now(), wdate) wgap "
+ "from board1 order by seq desc";
mysql에선 to_char를 date_format으로 변경하였고 truncate를 datediff로 바꿔서 한다.
sysdate는 now()로 바꾸고
WebContent.board2.board_list1
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!-- Java 전처리 -->
<%@ page import="java.util.ArrayList" %>
<%@ page import="model1.BoardTO" %>
<%@ page import="model1.BoardDAO" %>
<%
BoardDAO dao = new BoardDAO();
ArrayList<BoardTO> lists = dao.boardList();
int totalRecord = lists.size();
StringBuffer sb = new StringBuffer();
for(BoardTO to : lists) {
String seq = to.getSeq();
String subject = to.getSubject();
String writer = to.getWriter();
String wdate = to.getWdate();
String hit = to.getHit();
int wgap = to.getWgap();
sb.append("<tr>");
sb.append(" <td> </td>");
sb.append(" <td>" + seq + "</td>");
if(wgap == 0 ) {
sb.append(" <td class='left'><a href='./board_view1.jsp?seq=" + seq + "'>" + subject + "</a> <img src='../images/icon_hot.gif' alt='HOT'></td>");
} else {
sb.append(" <td class='left'><a href='./board_view1.jsp?seq=" + seq + "'>" + subject + "</a></td>");
}
sb.append(" <td>" + writer + "</td>");
sb.append(" <td>" + wdate + "</td>");
sb.append(" <td>" + hit + "</td>");
sb.append(" <td> </td>");
sb.append("</tr>");
}
%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="../css/board_list.css">
</head>
<body>
<!-- 상단 디자인 -->
<div class="con_title">
<h3>게시판</h3>
<p>HOME > 게시판 > <strong>게시판</strong></p>
</div>
<div class="con_txt">
<div class="contents_sub">
<div class="board_top">
<div class="bold">총 <span class="txt_orange">1</span>건</div>
</div>
<!--게시판-->
<div class="board">
<table>
<tr>
<th width="3%"> </th>
<th width="5%">번호</th>
<th>제목</th>
<th width="10%">글쓴이</th>
<th width="17%">등록일</th>
<th width="5%">조회</th>
<th width="3%"> </th>
</tr>
<tr>
<!-- 시작 -->
<%= sb %>
<!-- 끝 -->
</tr>
</table>
</div>
<!--//게시판-->
<div class="align_right">
<button type="button" class="btn_write btn_txt01" style="cursor: pointer;" onclick="location.href='board_write1.jsp'">쓰기</button>
</div>
</div>
</div>
<!--//하단 디자인 -->
</body>
</html>
[master@locahost ~]$ ./apache-tomcat-8.5.32/bin/catalina.sh run
Could not publish server configuration for Tomcat v8.5 Server at localhost. 에러가 뜰때는
server.xml로 들어가서
위를 아래와 같이 경로를 서로 맞춰주면 에러가 없어진다
앨범 게시판을 만들어 보자
mariadb에서 album_board1을 만들어 준다.
create table album_board1 (
seq int not null primary key auto_increment,
subject varchar(150) not null,
writer varchar(12) not null,
mail varchar(50),
password varchar(12) not null,
content varchar(2000),
filename varchar(200),
filesize int,
cmt int,
hit int not null,
wip varchar(15) not null,
wdate date not null
);
위 게시판 만든것 처럼 context.xml을 세팅해주고, DAO에서 sql문도 컬럼별로 수정하고 기존 AlbumEx02에서 한 model1 게시판을 가져와서 붙여넣고 Upload path만 수정해주면 된다
'Web & Mobile > Linux' 카테고리의 다른 글
Lecture 70 - Linux(8) 클라우드서버 데이터를 이용한 주소 검색 (0) | 2019.06.26 |
---|---|
Lecture 69 - Linux(7) 클라우드서버(네이버 ncloud) (0) | 2019.06.25 |
Lecture 67 - Linux(5) 네트워크, 원격관리 (0) | 2019.06.21 |
Lecture 66 - Linux(4) RPM 패키지, YUM 패키지, 톰캣 설치법, putty 사용법, vsftp 설치법 (0) | 2019.06.20 |
Lecture 65 - Linux(3) 작업예약, at, crontab (0) | 2019.06.19 |
댓글