If your WordPress website permalinks are not working on Amazon EC2 Linux or Ubuntu instance, it is because mod_rewrite is not enabled on your server instance. To Enable mod_rewrite in EC2 Linux and other configuration. You need to make changes in the apache config.conf file.
First, login to server using putty or any other SSH client.
Then switch to super user by using following command:
sudo su
Now change directory to the apache configuration dir, change directory to /etc/httpd/conf:
cd /etc/httpd/conf
Open apache server config file httpd.conf for editing using following command:
nano httpd.conf
Now scroll down using arrow keys and find , you need to change AllowOverride All from AllowOverride None.
<Directory "/var/www/html">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
After making above change, this save the file using Ctrl + o and press enter and to exit press Ctrl + x. Now to load new configuration, restart the apache server using following command:
service httpd restart
Worked perfectly! Thank you