Improve my.cnf from the server

A programmer friend told me to put this data on my.cnf from my server to improve performance.
[mysqld]
bind-address = 127.0.0.1
skip_name_resolve
local-infile = 0
max_connections = 1000
max_user_connections = 40
innodb_buffer_pool_size = 2G
innodb_buffer_pool_instances = 8
innodb_log_buffer_size = 64M
innodb_log_file_size = 512M
innodb_log_files_in_group = 4
innodb_flush_method = O_DIRECT
max_heap_table_size = 256M
tmp_table_size = 256M
table_open_cache = 64
table_definition_cache = 8192
thread_cache = 16
join_buffer_size = 16M
open_files_limit = 8192
key_buffer_size = 256M

Does it make any sense? If so, why does not it come this way by default?

what is your Server Specs

Server in Digital Ocean, 2GB / 50GB Disk