How to change port 80 into 8080 on my wordpress?

Posted September 4, 2015 73.3k 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 / {
    files $uri $uri/ =404;
    errorpage 404 /404.html;
    page 500 502 503 504 /50x.html;
    location = /50x.html {
    root /var/www/html;
    location ~ .php$ {
    tryfiles $uri =404;
    pass unix:/var/run/php5-fpm.sock;
    fastcgiindex index.php;
    param SCRIPTFILENAME $documentroot$fastcgiscriptname;
    include fastcgi_params;

  2. edit wordpress configuration.
    vim /var/www/html/wp/wp-config.php

    to add tow lines at the end of the file.


3.change the mysql
update wpoptions set optionvalue=’http://localhost:8080’ where option_name='siteurl’;

update wpoptions set optionvalue=’http://localhost:8080’ where option_name='home’;

Why htpp:// can get nothing ?

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.

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; masterprocess 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,an error info occur 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.
Submit an Answer