Both Methods,
1. On-site
2. Off-site

Quality Content, Lng Tail Keywords and Quality Link Building are most important in SEO.