Ubuntu15.04 Nginx, Apache2 Modify the default port number
Build a Web server via Ubuntu, and sometimes you need to modify the port number of the Web service as needed, and here I've compiled the process of modifying the default port number and site directory for Nginx and Apache.
nginx Modify Default port1. Modify the configuration file
Vi/etc/nginx/sites-enabled/defaultlisten Bayi default_server;# Modify the port number you need listen Bayi default_server;
2. Heavy-duty Nginx service
/etc/init.d/nginx Reload
3. Modify the default Site Directory
Vi/etc/nginx/sites-enabled/default #root/var/www/html; root/usr/share/nginx/html; # Modify the default site Directory
4. Modify the default home page document:
Modify or Replace index.htmlvi/usr/share/nginx/html/index.html # Modify index.html
Apache modifies the default port1. Modify the configuration file
(1) Modification of/etc/apache2/ports.conf will
Namevirtualhost *:80listen 80# Change to the port you need namevirtualhost *:9000listen 9000
(2) Some need to modify default and httpd.conf configuration files
#查找配置文件sudo Find/-name defaultsudo Find/-name httpd.conf
(3) Restart Apache
Sudo/etc/init.d/apache2 Restart Port modified. The Apache port has been modified to 9000.
2. Modify the default Site directory:
/etc/apache2/sites-available/default# will/var/www modify your path to the bit:/var/www/html/
3. Modify the default home page document:
/etc/apache2/mods-available/dir.conf# Replace index.* with xxx.*
4. Finally
However, different files are placed differently with apache2 versions.
See DirectoryIndex in Apache2 which file: Grep-ir directoryindex/etc/apache2
# my Ubuntu 15.04 is like this [email protected]:/etc/apache2/sites-enabled# grep-ir directoryindex/etc/apache2/etc/apache2/ Mods-enabled/dir.conf:directoryindex index.html index.cgi index.pl index.php index.xhtml index.htm/etc/apache2/ Mods-available/dir.conf:directoryindex index.html index.cgi index.pl index.php index.xhtml index.htm
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/8F/EF/wKioL1jt4zHw9yPNAABoEBLWGqI679.png "/>
This article is from the "Ops Little Boss" blog, please be sure to keep this source http://solin.blog.51cto.com/11319413/1915262
Nginx, Apache2 Modify the default port number