How to change port 80 into 8080 on my wordpress?

Posted September 4, 2015 80k views

I have installed LEMP +wordpress on my
Now i want to make 80 into 8080,let can be visited.

  1. edit nginx configuration
server {
listen 8080;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ =404;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/html;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
  1. edit wordpress configuration.
vim /var/www/html/wp/wp-config.php

Add the following lines at the end of the file:


3.Access mysql and run the following queries:

update wp_options set option_value='http://localhost:8080' where option_name='siteurl';

update wp_options set option_value='http://localhost:8080' where option_name='home';

Why htpp:// can get nothing ?

edited by bobbyiliev
1 comment

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
3 answers

Perhaps a stupid question, but you did restart Nginx after you’ve made the changes?
Is the main nginx.conf also listening at 8080?

@Martijns Indeed did you restart nginx? Also a simple one; are you running any firewall / did you portforward the port?

No firewall ,nothing.

I met a big trouble!I try to set nginx configuration to test and test, install and uninstall many times.
My os messed up.

root@pengsir:/home/debian8# dpkg -l  nginx
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
ii  nginx          1.6.2-5      all          small, powerful, scalable web/pro
root@pengsir:/home/debian8# service nginx start
root@pengsir:/home/debian8# service nginx status
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
   Active: active (running) since Sun 2015-09-06 21:32:33 HKT; 1min 17s ago
  Process: 15457 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
  Process: 15455 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
 Main PID: 15458 (nginx)
   CGroup: /system.slice/nginx.service
           ├─15458 nginx: master process /usr/sbin/nginx -g daemon on; master...
           ├─15459 nginx: worker process
           ├─15460 nginx: worker process
           ├─15461 nginx: worker process
           └─15462 nginx: worker process

It seems like that nginx is in good status, but an error occurs when to input

Unable to connect

Iceweasel can't establish a connection to the server at

    The site could be temporarily unavailable or too busy. Try again in a few moments.
    If you are unable to load any pages, check your computer's network connection.
    If your computer or network is protected by a firewall or proxy, make sure that Iceweasel is permitted to access the Web.
edited by bobbyiliev