Skip to content

Commit

Permalink
Merge pull request #1 from HammerCloth/dev
Browse files Browse the repository at this point in the history
TikTok v1.0
  • Loading branch information
liuzongzhou authored May 23, 2022
2 parents 03c6593 + d5917e7 commit d24080f
Show file tree
Hide file tree
Showing 59 changed files with 3,121 additions and 20 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
# tiktok
# tiktok-dev

## 项目编译部署
```shell
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build ./
```
5 changes: 5 additions & 0 deletions config/commentConfit.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package config

const ValidComment = 0 //评论状态:有效
const InvalidComment = 1 //用户状态:取消
const DateTime = "2006-01-02 15:04:05"
21 changes: 21 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package config

// Secret 密钥
var Secret = "tiktok"

// OneDayOfHours 时间
var OneDayOfHours = 60 * 60 * 24
var OneMinute = 60 * 1
var OneMonth = 60 * 60 * 24 * 30

// VideoCount 每次获取视频流的数量
const VideoCount = 5

// ConConfig ftp服务器地址
const ConConfig = "43.138.25.60:21"
const FtpUser = "ftpuser"
const FtpPsw = "424193726"

// PlayUrlPrefix 存储的图片和视频的链接
const PlayUrlPrefix = "http://43.138.25.60/"
const CoverUrlPrefix = "http://43.138.25.60/images/"
5 changes: 5 additions & 0 deletions config/likeconfig.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package config

const Islike = 0 //点赞的状态
const Unlike = 1 //取消赞的状态
const Likeaction = 1 //点赞的行为
89 changes: 89 additions & 0 deletions config/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# 服务器nginx配置
# 已经配置好图片服务器,视频服务器
#user www www;
worker_processes auto;
#error_log /www/wwwlogs/nginx_error.log crit;
pid /www/server/nginx/logs/nginx.pid;
worker_rlimit_nofile 51200;

events
{
use epoll;
worker_connections 51200;
multi_accept on;
}

http
{
include mime.types;
#include luawaf.conf;

#include proxy.conf;

default_type application/octet-stream;

#server_names_hash_bucket_size 512;
#client_header_buffer_size 32k;
#large_client_header_buffers 4 32k;
#client_max_body_size 50m;

sendfile on;
tcp_nopush on;

keepalive_timeout 60;

tcp_nodelay on;
autoindex on; #开启nginx目录浏览功能
autoindex_exact_size off; #文件大小从KB开始显示
autoindex_localtime on; #显示文件修改时间为服务器本地时间

fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE [1-6]\.";

limit_conn_zone $binary_remote_addr zone=perip:10m;
limit_conn_zone $server_name zone=perserver:10m;

server_tokens off;
access_log off;

server
{
listen 80;
# server_name video;
index index.html;
root /home/ftpuser/video;

error_page 404 /404.html;
#include enable-php.conf;

location / {
root html;
index index.html index.htm;
}
#http://43.138.25.60/1.mp4
location ~ .*\.mp4$ {
mp4;
}
#http://43.138.25.60/images/a.jpg
location /images{
root /home/ftpuser;
}
access_log /www/wwwlogs/access.log;
}
# include /www/server/panel/vhost/nginx/*.conf;
}
127 changes: 127 additions & 0 deletions config/vsftpd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
# When SELinux is enforcing check for SE bool ftp_home_dir
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
# When SELinux is enforcing check for SE bool allow_ftpd_anon_write, allow_ftpd_full_access
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/xferlog
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode. The vsftpd.conf(5) man page explains
# the behaviour when these options are disabled.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd/banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
#chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd/chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=YES
#
# This directive enables listening on IPv6 sockets. By default, listening
# on the IPv6 "any" address (::) will accept connections from both IPv6
# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
# sockets. If you want that (perhaps because you want to listen on specific
# addresses) then you must run two copies of vsftpd with two configuration
# files.
# Make sure, that one of the listen options is commented !!
listen_ipv6=NO

pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
#仅允许user_list文件中的用户访问FTP服务
userlist_deny=NO
#被动模式端口范围
pasv_min_port=30000
pasv_max_port=30999

Loading

0 comments on commit d24080f

Please sign in to comment.